Class ComparisonExpressions
java.lang.Object
dev.morphia.aggregation.expressions.ComparisonExpressions
Defines helper methods for the comparison expressions
- Since:
- 2.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic Expression
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.static Expression
Creates an equality check expressionstatic Expression
Compares two values and returns: true when the first value is greater than the second value.static Expression
Compares two values and returns: true when the first value is greater than or equivalent to the second value.static Expression
Creates a "less than" comparison.static Expression
Compares two values and returns: true when the first value is less than or equivalent to the second value.static Expression
Creates an inequality check expression
-
Method Details
-
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.- Parameters:
first
- an expression for the value to comparesecond
- an expression yielding the value to check against- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $cmp
-
eq
Creates an equality check expression- Parameters:
first
- an expression for the value to comparesecond
- an expression yielding the value to check against- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $eq
-
gt
Compares two values and returns:- true when the first value is greater than the second value.
- false when the first value is less than or equivalent to the second value.
- Parameters:
first
- an expression for the value to comparesecond
- an expression yielding the value to check against- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $gt
-
gte
Compares two values and returns:- true when the first value is greater than or equivalent to the second value.
- false when the first value is less than the second value.
- Parameters:
first
- an expression for the value to comparesecond
- an expression yielding the value to check against- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $gte
-
lt
Creates a "less than" comparison.- Parameters:
first
- an expression for the value to comparesecond
- an expression yielding the value to check against- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $lt
-
lte
Compares two values and returns:- true when the first value is less than or equivalent to the second value.
- false when the first value is greater than the second value.
- Parameters:
first
- an expression for the value to comparesecond
- an expression yielding the value to check against- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $lte
-
ne
Creates an inequality check expression- Parameters:
first
- an expression for the value to comparesecond
- an expression yielding the value to check against- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $ne
-