Class ComparisonExpressions


  • public final class ComparisonExpressions
    extends Object
    Defines helper methods for the comparison expressions
    Since:
    2.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static dev.morphia.aggregation.expressions.impls.Expression cmp​(dev.morphia.aggregation.expressions.impls.Expression first, dev.morphia.aggregation.expressions.impls.Expression second)
      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 dev.morphia.aggregation.expressions.impls.Expression eq​(dev.morphia.aggregation.expressions.impls.Expression first, dev.morphia.aggregation.expressions.impls.Expression second)
      Returns true if the values are equivalent.
      static dev.morphia.aggregation.expressions.impls.Expression gt​(dev.morphia.aggregation.expressions.impls.Expression first, dev.morphia.aggregation.expressions.impls.Expression second)
      Compares two values and returns: true when the first value is greater than the second value.
      static dev.morphia.aggregation.expressions.impls.Expression gte​(dev.morphia.aggregation.expressions.impls.Expression first, dev.morphia.aggregation.expressions.impls.Expression second)
      Compares two values and returns: true when the first value is greater than or equivalent to the second value.
      static dev.morphia.aggregation.expressions.impls.Expression lt​(dev.morphia.aggregation.expressions.impls.Expression first, dev.morphia.aggregation.expressions.impls.Expression second)
      Returns true if the first value is less than the second.
      static dev.morphia.aggregation.expressions.impls.Expression lte​(dev.morphia.aggregation.expressions.impls.Expression first, dev.morphia.aggregation.expressions.impls.Expression second)
      Compares two values and returns: true when the first value is less than or equivalent to the second value.
      static dev.morphia.aggregation.expressions.impls.Expression ne​(dev.morphia.aggregation.expressions.impls.Expression first, dev.morphia.aggregation.expressions.impls.Expression second)
      Returns true if the values are not equivalent.
    • Method Detail

      • cmp

        public static dev.morphia.aggregation.expressions.impls.Expression cmp​(dev.morphia.aggregation.expressions.impls.Expression first,
                                                                               dev.morphia.aggregation.expressions.impls.Expression second)
        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 compare
        second - an expression yielding the value to check against
        Returns:
        the new expression
        MongoDB documentation
        Aggregration Expression: $cmp
      • eq

        public static dev.morphia.aggregation.expressions.impls.Expression eq​(dev.morphia.aggregation.expressions.impls.Expression first,
                                                                              @Nullable
                                                                              dev.morphia.aggregation.expressions.impls.Expression second)
        Returns true if the values are equivalent.
        Parameters:
        first - an expression for the value to compare
        second - an expression yielding the value to check against
        Returns:
        the new expression
        MongoDB documentation
        Aggregration Expression: $eq
      • gt

        public static dev.morphia.aggregation.expressions.impls.Expression gt​(dev.morphia.aggregation.expressions.impls.Expression first,
                                                                              dev.morphia.aggregation.expressions.impls.Expression second)
        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 compare
second - an expression yielding the value to check against
Returns:
the new expression
MongoDB documentation
Aggregration Expression: $gt
  • gte

    public static dev.morphia.aggregation.expressions.impls.Expression gte​(dev.morphia.aggregation.expressions.impls.Expression first,
                                                                           dev.morphia.aggregation.expressions.impls.Expression second)
    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 compare
second - an expression yielding the value to check against
Returns:
the new expression
MongoDB documentation
Aggregration Expression: $gte