Upstash Documentation

Range Operators

1 min read

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
KEYWORDYes
FACETNo

Examples#