Logical Query Operators
On this page
This version of the documentation is archived and no longer
supported. View the current documentation to learn how to
upgrade your version of MongoDB.
Logical operators return data based on expressions that evaluate to true or false.
Compatibility
You can use logical query operators for deployments hosted in the following environments:
MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
MongoDB Enterprise: The subscription-based, self-managed version of MongoDB
MongoDB Community: The source-available, free-to-use, and self-managed version of MongoDB
Operators
Note
For details on a specific operator, including syntax and examples, click on the link to the operator's reference page.
Name | Description |
---|---|
Joins query clauses with a logical AND returns all documents that match the conditions of both clauses. | |
Inverts the effect of a query expression and returns documents that do not match the query expression. | |
Joins query clauses with a logical NOR returns all documents that fail to match both clauses. | |
Joins query clauses with a logical OR returns all documents that match the conditions of either clause. |