Documentation

contains() function

The contains() function tests whether a value is a member of a set. If the value is a member of the set, the function returns true. If the value is not a member of the set, the functions returns false.

contains(
    value: 1,
    set: [1,2,3],
)

Parameters

value

Value to search for.

set

Set of values to search in.

Examples

Filter on a set of specific fields

import "influxdata/influxdb/sample"

fields = ["temperature", "humidity"]

sample.data(set: "airSensor")
    |> range(start: -30m)
    |> filter(fn: (r) => contains(value: r._field, set: fields))

View example input and output


Was this page helpful?

Thank you for your feedback!


Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.