Class SetExpressions

java.lang.Object
dev.morphia.aggregation.expressions.SetExpressions

public final class SetExpressions extends Object
Defines helper methods for the set expressions
Since:
2.0
  • Method Details

    • allElementsTrue

      public static Expression allElementsTrue(Object first, Object... additional)
      Returns true if no element of a set evaluates to false, otherwise, returns false. Accepts a single argument expression.
      Parameters:
      first - an expression to evaluate
      additional - any additional expressions
      Returns:
      the new expression
      MongoDB documentation
      Aggregration Expression: $allElementsTrue
    • anyElementTrue

      public static Expression anyElementTrue(Object first, Object... additional)
      eturns true if any elements of a set evaluate to true; otherwise, returns false. Accepts a single argument expression.
      Parameters:
      first - an expression to evaluate
      additional - any additional expressions
      Returns:
      the new expression
      MongoDB documentation
      Aggregration Expression: $anyElementTrue
    • setDifference

      public static Expression setDifference(Object first, Object second)
      Returns a set with elements that appear in the first set but not in the second set; i.e. performs a relative complement of the second set relative to the first. Accepts exactly two argument expressions.
      Parameters:
      first - the first array expression
      second - the second expression
      Returns:
      the new expression
      MongoDB documentation
      Aggregration Expression: $setDifference
    • setEquals

      public static Expression setEquals(Object first, Object... additional)
      Returns true if the input sets have the same distinct elements. Accepts two or more argument expressions.
      Parameters:
      first - the first array expression
      additional - additional expressions
      Returns:
      the new expression
      MongoDB documentation
      Aggregration Expression: $setEquals
    • setIntersection

      public static Expression setIntersection(Object first, Object... additional)
      Returns a set with elements that appear in all of the input sets. Accepts any number of argument expressions.
      Parameters:
      first - the first array expression
      additional - additional expressions
      Returns:
      the new expression
      MongoDB documentation
      Aggregration Expression: $setIntersection
    • setIsSubset

      public static Expression setIsSubset(Object first, Object second)
      Returns true if all elements of the first set appear in the second set, including when the first set equals the second set; i.e. not a strict subset. Accepts exactly two argument expressions.
      Parameters:
      first - the first array expression
      second - the second expression
      Returns:
      the new expression
      MongoDB documentation
      Aggregration Expression: $setIsSubset
    • setUnion

      public static Expression setUnion(Object first, Object... additional)
      Returns a set with elements that appear in any of the input sets.
      Parameters:
      first - the first array expression
      additional - additional expressions
      Returns:
      the new expression
      MongoDB documentation
      Aggregration Expression: $setUnion