Class SetExpressions


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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static dev.morphia.aggregation.expressions.impls.Expression allElementsTrue​(dev.morphia.aggregation.expressions.impls.Expression first, dev.morphia.aggregation.expressions.impls.Expression... additional)
      Returns true if no element of a set evaluates to false, otherwise, returns false.
      static dev.morphia.aggregation.expressions.impls.Expression anyElementTrue​(dev.morphia.aggregation.expressions.impls.Expression first, dev.morphia.aggregation.expressions.impls.Expression... additional)
      Returns true if any elements of a set evaluate to true; otherwise, returns false.
      static dev.morphia.aggregation.expressions.impls.Expression setDifference​(dev.morphia.aggregation.expressions.impls.Expression first, dev.morphia.aggregation.expressions.impls.Expression second)
      Returns a set with elements that appear in the first set but not in the second set; i.e.
      static dev.morphia.aggregation.expressions.impls.Expression setEquals​(dev.morphia.aggregation.expressions.impls.Expression first, dev.morphia.aggregation.expressions.impls.Expression... additional)
      Returns true if the input sets have the same distinct elements.
      static dev.morphia.aggregation.expressions.impls.Expression setIntersection​(dev.morphia.aggregation.expressions.impls.Expression first, dev.morphia.aggregation.expressions.impls.Expression... additional)
      Returns a set with elements that appear in all of the input sets.
      static dev.morphia.aggregation.expressions.impls.Expression setIsSubset​(dev.morphia.aggregation.expressions.impls.Expression first, dev.morphia.aggregation.expressions.impls.Expression 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.
      static dev.morphia.aggregation.expressions.impls.Expression setUnion​(dev.morphia.aggregation.expressions.impls.Expression first, dev.morphia.aggregation.expressions.impls.Expression... additional)
      Returns a set with elements that appear in any of the input sets.
    • Method Detail

      • allElementsTrue

        public static dev.morphia.aggregation.expressions.impls.Expression allElementsTrue​(dev.morphia.aggregation.expressions.impls.Expression first,
                                                                                           dev.morphia.aggregation.expressions.impls.Expression... 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 dev.morphia.aggregation.expressions.impls.Expression anyElementTrue​(dev.morphia.aggregation.expressions.impls.Expression first,
                                                                                          dev.morphia.aggregation.expressions.impls.Expression... additional)
        Returns 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 dev.morphia.aggregation.expressions.impls.Expression setDifference​(dev.morphia.aggregation.expressions.impls.Expression first,
                                                                                         dev.morphia.aggregation.expressions.impls.Expression 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 dev.morphia.aggregation.expressions.impls.Expression setEquals​(dev.morphia.aggregation.expressions.impls.Expression first,
                                                                                     dev.morphia.aggregation.expressions.impls.Expression... 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 dev.morphia.aggregation.expressions.impls.Expression setIntersection​(dev.morphia.aggregation.expressions.impls.Expression first,
                                                                                           dev.morphia.aggregation.expressions.impls.Expression... 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 dev.morphia.aggregation.expressions.impls.Expression setIsSubset​(dev.morphia.aggregation.expressions.impls.Expression first,
                                                                                       dev.morphia.aggregation.expressions.impls.Expression 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 dev.morphia.aggregation.expressions.impls.Expression setUnion​(dev.morphia.aggregation.expressions.impls.Expression first,
                                                                                    dev.morphia.aggregation.expressions.impls.Expression... 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