Documentation

dict.remove() function

The dict.remove() function removes a key value pair from a dictionary and returns an updated dictionary.

import "dict"

dict.remove(
  dict: [1: "foo", 2: "bar"],
  key: 1
)

Parameters

All paremeters are required

dict

Dictionary to remove a key-value pair from.

Data type: Dictionary

key

Key to remove from the dictionary. Must be the same type as existing keys in the dictionary.

Data type: String | Boolean | Integer | Uinteger | Float | Time | Bytes

Examples

Remove a property from a dictionary
import "dict"

d = [1: "foo", 2: "bar"]

dNew = dict.remove(
  dict: d,
  key: 1
)

// Verify the key-value pairs was removed

dict.get(dict: dNew, key: 1, default: "")
// Returns an empty string

dict.get(dict: dNew, key: 2, default: "")
// Returns bar

Cloud or OSS?

InfluxDB OSS 2.0 now generally available!

InfluxDB OSS 2.0 is now generally available and ready for production use. See the InfluxDB OSS 2.0 release notes.

For information about upgrading to InfluxDB OSS 2.0, see: