Skip to main content
Range operators filter documents based on numeric or date field boundaries. You can use them to find values within a range, above a threshold, or below a limit.
OperatorDescriptionExample
$gtGreater than (exclusive)price > 100
$gteGreater than or equal (inclusive)price >= 100
$ltLess than (exclusive)price < 200
$lteLess than or equal (inclusive)price <= 200
You can combine multiple range operators on the same field to create bounded ranges. For example, { $gte: 100, $lte: 200 } matches values from 100 to 200 inclusive. For open-ended ranges, use a single operator. For example, { $gt: 500 } matches all values greater than 500 with no upper limit.

Compatibility

Field TypeSupported
TEXTNo
U64/I64/F64Yes
DATEYes
BOOLNo

Examples

// Price range
await products.query({
  filter: {
    price: { $gte: 100, $lte: 200 },
  },
});

// Open-ended range (no upper bound)
await products.query({
  filter: {
    price: { $gt: 500 },
  },
});

// Date range (no lower bound)
await users.query({
  filter: {
    createdAt: { $lt: "2024-02-01T00:00:00Z" },
  },
});