Class SetExpressions
java.lang.Object
dev.morphia.aggregation.expressions.SetExpressions
Defines helper methods for the set expressions
- Since:
- 2.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic Expression
allElementsTrue
(Object first, Object... additional) Returns true if no element of a set evaluates to false, otherwise, returns false.static Expression
anyElementTrue
(Object first, Object... additional) eturns true if any elements of a set evaluate to true; otherwise, returns false.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.static Expression
Returns true if the input sets have the same distinct elements.static Expression
setIntersection
(Object first, Object... additional) Returns a set with elements that appear in all of the input sets.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.static Expression
Returns a set with elements that appear in any of the input sets.
-
Method Details
-
allElementsTrue
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
eturns 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
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
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
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
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
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
-