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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ExpressionallElementsTrue(Expression first, Expression... additional)Returns true if no element of a set evaluates to false, otherwise, returns false.static ExpressionanyElementTrue(Expression first, Expression... additional)Returns true if any elements of a set evaluate to true; otherwise, returns false.static ExpressionsetDifference(Expression first, 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.static ExpressionsetEquals(Expression first, Expression... additional)Returns true if the input sets have the same distinct elements.static ExpressionsetIntersection(Expression first, Expression... additional)Returns a set with elements that appear in all of the input sets.static ExpressionsetIsSubset(Expression first, 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 ExpressionsetUnion(Expression first, Expression... additional)Returns a set with elements that appear in any of the input sets.
-
-
-
Method Detail
-
allElementsTrue
public static Expression allElementsTrue(Expression first, 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 evaluateadditional- any additional expressions- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $allElementsTrue
-
anyElementTrue
public static Expression anyElementTrue(Expression first, 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 evaluateadditional- any additional expressions- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $anyElementTrue
-
setDifference
public static Expression setDifference(Expression first, 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 expressionsecond- the second expression- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $setDifference
-
setEquals
public static Expression setEquals(Expression first, Expression... additional)
Returns true if the input sets have the same distinct elements. Accepts two or more argument expressions.- Parameters:
first- the first array expressionadditional- additional expressions- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $setEquals
-
setIntersection
public static Expression setIntersection(Expression first, 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 expressionadditional- additional expressions- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $setIntersection
-
setIsSubset
public static Expression setIsSubset(Expression first, 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 expressionsecond- the second expression- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $setIsSubset
-
setUnion
public static Expression setUnion(Expression first, Expression... additional)
Returns a set with elements that appear in any of the input sets.- Parameters:
first- the first array expressionadditional- additional expressions- Returns:
- the new expression
- MongoDB documentation
- Aggregration Expression: $setUnion
-
-