Database Manual / Reference / Query Language / Query Predicates

Comparison Query Predicate Operators

Comparison operators filter data based on value comparisons such as less than and greater than.

For comparison of different BSON type values, see the specified BSON comparison order.

OperatorDescription

$eq

Matches values that are equal to a specified value.

$gt

Matches values that are greater than a specified value.

$gte

Matches values that are greater than or equal to a specified value.

$in

Matches any of the values specified in an array.

$lt

Matches values that are less than a specified value.

$lte

Matches values that are less than or equal to a specified value.

$ne

Matches all values that are not equal to a specified value.

$nin

Matches if the value is not equal to any of a given list of values.

Compatibility

You can use comparison operators for deployments hosted in the following environments:

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud