Database Manual / Reference / Query Language / Query Predicates

Logical Query Predicate Operators

Logical operators return data based on boolean logic (and, or, and nor).

NameDescription

$and

Joins query clauses with a logical AND and returns documents that match the conditions of all clauses.

$nor

Joins query clauses with a logical NOR and returns all documents that fail to match all clauses.

$not

Inverts the effect of a query predicate and returns documents that do not match the query predicate.

$or

Joins query clauses with a logical OR and returns all documents that match at least one clause.

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