Query Operators

MongoDB-compatible query language with JSON syntax. Dot notation for nested fields.

Comparison

OperatorDescriptionExample
$eqEquals{"age": {"$eq": 30}} or just {"age": 30}
$neNot equal{"status": {"$ne": "inactive"}}
$gtGreater than{"age": {"$gt": 25}}
$gteGreater than or equal{"age": {"$gte": 25}}
$ltLess than{"salary": {"$lt": 100000}}
$lteLess than or equal{"salary": {"$lte": 100000}}
$inMatch any in array{"country": {"$in": ["US", "UK", "JP"]}}
$existsField exists{"email": {"$exists": true}}
$regexRegular expression{"name": {"$regex": "^A", "$options": "i"}}

Logical

OperatorDescriptionExample
$andAll conditions match{"$and": [{"age": {"$gte": 25}}, {"status": "active"}]}
$orAny condition matches{"$or": [{"city": "Tokyo"}, {"city": "Paris"}]}

Find Options

{
  "sort": {"age": -1, "name": 1},
  "skip": 20,
  "limit": 10
}

Sort values: 1 ascending, -1 descending. When an index covers the sort field, sort is O(limit) instead of O(n log n).

Nested Fields

// Dot notation for nested access
{"address.city": "Tokyo"}
{"address.zip": {"$regex": "^0"}}

Type Ordering

Cross-type comparisons follow a consistent ordering:

Null < Bool < Number < DateTime < String

Date strings (ISO 8601, RFC 3339, YYYY-MM-DD) are auto-detected and stored as epoch milliseconds.