Database Manual / Reference / Query Language / Query Predicates

Logical Query Predicate Operators逻辑查询谓词运算符

Logical operators return data based on boolean logic (and, or, and nor).逻辑运算符基于布尔逻辑(and、or和nor)返回数据。

Name名字Description描述
$andJoins query clauses with a logical AND and returns documents that match the conditions of all clauses.使用逻辑AND连接查询子句,并返回符合所有子句条件的文档。
$norJoins query clauses with a logical NOR and returns all documents that fail to match all clauses.将查询子句与逻辑NOR连接,并返回所有与所有子句不匹配的文档。
$notInverts the effect of a query predicate and returns documents that do not match the query predicate.反转查询谓词的效果,并返回与查询谓词不匹配的文档。
$orJoins query clauses with a logical OR and returns all documents that match at least one clause.使用逻辑OR连接查询子句,并返回至少与一个子句匹配的所有文档。

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:云中MongoDB部署的完全托管服务
  • MongoDB Enterprise: The subscription-based, self-managed version of MongoDB:MongoDB的基于订阅的自我管理版本
  • MongoDB Community: The source-available, free-to-use, and self-managed version of MongoDB:MongoDB的源代码可用、免费使用和自我管理版本