Logical operators return data based on boolean logic (and, or, and nor).逻辑运算符基于布尔逻辑(and、or和nor)返回数据。
$and | AND and returns documents that match the conditions of all clauses.AND连接查询子句,并返回符合所有子句条件的文档。 |
$nor | NOR and returns all documents that fail to match all clauses.NOR连接,并返回所有与所有子句不匹配的文档。 |
$not | |
$or | 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的源代码可用、免费使用和自我管理版本