Documentation

Check if a value exists

This page documents an earlier version of InfluxDB OSS. InfluxDB 3 Core is the latest stable version.

Use the exists operator to check if a row record contains a column or if a column’s value is null.

(r) => exists r.column

If you’re just getting started with Flux queries, check out the following:

Use exists with row functions ( filter(), map(), reduce()) to check if a row includes a column or if the value for that column is null.

Filter null values

from(bucket: "example-bucket")  |> range(start: -5m)  |> filter(fn: (r) => exists r._value)

Map values based on existence

from(bucket: "default")  |> range(start: -30s)  |> map(  fn: (r) => ({r with  human_readable: if exists r._value then  "${r._field} is ${string(v: r._value)}."  else  "${r._field} has no value.",  }),  )

Ignore null values in a custom aggregate function

customSumProduct = (tables=<-) => tables  |> reduce(  identity: {sum: 0.0, product: 1.0},  fn: (r, accumulator) => ({r with  sum: if exists r._value then  r._value + accumulator.sum  else  accumulator.sum,  product: if exists r._value then  r.value * accumulator.product  else  accumulator.product,  }),  )

Check if a statically defined record contains a key

When you use the record literal syntax to statically define a record, Flux knows the record type and what keys to expect.

  • If the key exists in the static record, exists returns true.
  • If the key exists in the static record, but has a null value, exists returns false.
  • If the key does not exist in the static record, because the record type is statically known, exists returns an error.
import "internal/debug"  p = {  firstName: "John",  lastName: "Doe",  age: 42,  height: debug.null(type: "int"), }  exists p.firstName // Returns true  exists p.height // Returns false  exists p.hairColor // Returns "error: record is missing label hairColor" 

Was this page helpful?

Thank you for your feedback!


New in InfluxDB 3.8

Key enhancements in InfluxDB 3.8 and the InfluxDB 3 Explorer 1.6.

See the Blog Post

InfluxDB 3.8 is now available for both Core and Enterprise, alongside the 1.6 release of the InfluxDB 3 Explorer UI. This release is focused on operational maturity and making InfluxDB easier to deploy, manage, and run reliably in production.

For more information, check out:

InfluxDB Docker latest tag changing to InfluxDB 3 Core

On February 3, 2026, the latest tag for InfluxDB Docker images will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments.

If using Docker to install and run InfluxDB, the latest tag will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments. For example, if using Docker to run InfluxDB v2, replace the latest version tag with a specific version tag in your Docker pull command–for example:

docker pull influxdb:2