MongoDB Query and Projection Operators
Comparison Query operators
| Name | Description |
|---|---|
| $gt | Matches values that are greater than the value specified in the query. |
| $lt | Matches values that are less than the value specified in the query. |
| $gte | Matches values that are greater than or equal to the value specified in the query. |
| $lte | Matches values that are less than or equal to the value specified in the query. |
| $ne | Matches all values that are not equal to the value specified in the query. |
| $in | Matches any of the values that exist in an array specified in the query. |
| $nin | Matches values that do not exist in an array specified in the query. |
Logical Query operators
| Name | Description |
|---|---|
| $and | Joins query clauses with a logical AND returns all documents that match the conditions of both clauses. |
| $not | Inverts the effect of a query expression and returns documents that do not match the query expression. |
| $or | Joins query clauses with a logical OR returns all documents that match the conditions of either clause. |
| $nor | Joins query clauses with a logical NOR returns all documents that fail to match both clauses. |
Element Query operators
| Name | Description |
|---|---|
| $exists | Matches documents that have the specified field. |
| $type | Selects documents if a field is of the specified type. |
Evaluation Query operators
| Name | Description |
|---|---|
| $mod | Performs a modulo operation on the value of a field and selects documents with a specified result. |
| $regex | Selects documents where values match a specified regular expression. |
| $where | Matches documents that satisfy a JavaScript expression. |
Query operator Array
| Name | Description |
|---|---|
| $all | Matches arrays that contain all elements specified in the query. |
| $elemMatch | Selects documents if an element in the array field matches all the specified $elemMatch conditions. |
| $size | Selects documents if the array field is a specified size. |
Projection operator
| Name | Description |
|---|---|
| $ | Projects the first element in an array that matches the query condition. |
| $elemMatch(projection) | Projects the first element in an array that matches the specified $elemMatch condition. |
| $slice | Limits the number of elements projected from an array. Supports skip and limit slices. |
Previous:
MongoDB CONNECTIONS
Next:
Comparison Query Operators $gt $lt $gte $lte
