Skip to main content
A filter matches documents by their metadata. Pass it as filter to a query or a delete.

Equality

A value matches metadata equal to it, or an array that holds it:
This matches "tags": "billing" and "tags": ["billing", "refunds"]. Equality compares as text, so 3, 3.0 and "3" match one another. $in matches any value in a list:

Ranges

$gt, $gte, $lt and $lte compare numbers with numbers and strings with strings:
Strings compare byte by byte, so ISO 8601 dates sort correctly:
  • Booleans and array items never match a range.
  • A string longer than about 220 bytes never matches a range, and a bound that long returns 400 invalid_filter.
  • Documents written before October 3, 2026 match ranges only once they’re written again.

And, or

Keys in one object must all match. $or matches any of its filters, and $and all of them:

Operators

There is no “not equal” ($ne, $nin).

Limits

  • Up to 256 conditions, nested up to 8 levels. $in takes up to 255 values.
  • Filter keys aren’t checked: a misspelled key matches nothing.
  • An invalid filter returns 400 invalid_filter, and message says what’s wrong.