function

Exists

Match documents that have a value for a field, or that have none.

Example

go
query.Exists("image", true)

Arguments

ArgumentTypeDescription
pathPThe field, as a dot-separated name such as "seo.title" or a Path.
existsbooltrue matches documents with a value; false matches documents without one.

Returns

The comparison.

Expression

Full signature

Related types

  • FieldPath

    A field name in a filter or sort: a string such as "seo.title", or a Path.

  • Expression

    A sealed immutable predicate consumed atomically by stores.

Related guides