翻译或纠错本页面
- Reference >
- Operators >
- Aggregation Pipeline Operators >
- Comparison Aggregation Operators
Comparison Aggregation Operators¶
Comparison expressions return a boolean except for $cmp which returns a number.
The comparison expressions take two argument expressions and compare both value and type, using the specified BSON comparison order for values of different types.
注解
For details on specific operator, including syntax and examples, click on the specific operator to go to its reference page.
Name | Description |
---|---|
$cmp | Returns: 0 if the two values are equivalent, 1 if the first value is greater than the second, and -1 if the first value is less than the second. |
$eq | Returns true if the values are equivalent. |
$gt | Returns true if the first value is greater than the second. |
$gte | Returns true if the first value is greater than or equal to the second. |
$lt | Returns true if the first value is less than the second. |
$lte | Returns true if the first value is less than or equal to the second. |
$ne | Returns true if the values are not equivalent. |