Query predicates are expressions that return a boolean that indicates
whether a document matches a specified query. For example, { name: {
$eq: "Alice" } } is a query predicate that returns documents where the
value of the "name" field is the string "Alice".
To match the correct documents, you can use the following types of operators in query predicates:
Operator Type | Description |
|---|---|
Return data based on array conditions. | |
Return data based on bit position conditions. | |
Return data based on value comparisons such as less than and greater than. | |
Return data based on field existence or data types. | |
Perform specialized functions in query predicates. | |
Return data based on boolean logic (and, or, and nor). | |
Return data based on geospatial query predicates, such as containment within a region on the surface of the Earth. |
Alphabetical List of Operators
Name | Description |
|---|---|
Matches arrays that contain all elements specified in the query. | |
Joins query clauses with a logical | |
Matches numeric or binary values in which a set of bit positions
all have a value of | |
Matches numeric or binary values in which a set of bit positions
all have a value of | |
Matches numeric or binary values in which any bit from a set of
bit positions has a value of | |
Matches numeric or binary values in which any bit from a set of
bit positions has a value of | |
Selects documents if at least one element in the array field matches all
the specified | |
Matches values that are equal to a specified value. | |
Matches documents that have the specified field. | |
Allows use of expressions in query predicates. | |
Selects geometries that intersect with a GeoJSON geometry.
The 2dsphere index supports
| |
Selects geometries within a bounding GeoJSON geometry. The 2dsphere and 2d indexes support
| |
Matches values that are greater than a specified value. | |
Matches values that are greater than or equal to a specified value. | |
Validates documents against the given JSON Schema. | |
Matches any of the values specified in an array. | |
Matches values that are less than a specified value. | |
Matches values that are less than or equal to a specified value. | |
Matches documents based on the result of a modulo operation on a field value. | |
Matches all values that are not equal to a specified value. | |
Returns geospatial objects in proximity to a point.
Requires a geospatial index. The | |
Returns geospatial objects in proximity to a point on a sphere.
Requires a geospatial index. The | |
Matches if the value is not equal to any of a given list of values. | |
Joins query clauses with a logical | |
Inverts the effect of a query predicate and returns documents that do not match the query predicate. | |
Joins query clauses with a logical | |
Matches documents where values match a specified regular expression. | |
Selects documents if the array field contains the specified number of elements. | |
Matches documents if a field is of the specified type. | |
Matches documents that satisfy a JavaScript expression. |