- 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.
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. |