Class AggregationSpELExpression
java.lang.Object
org.springframework.data.mongodb.core.aggregation.AggregationSpELExpression
- All Implemented Interfaces:
AggregationExpression, MongoExpression
An
Samples:
AggregationExpression that renders a MongoDB Aggregation Framework expression from the AST of a
SpEL
expression. Samples:
// { $and: [ { $gt: [ "$qty", 100 ] }, { $lt: [ "$qty", 250 ] } ] }
expressionOf("qty > 100 && qty < 250");
// { $cond : { if : { $gte : [ "$a", 42 ]}, then : "answer", else : "no-answer" } }
expressionOf("cond(a >= 42, 'answer', 'no-answer')");
- Since:
- 1.10
- Author:
- Christoph Strobl, Mark Paluch
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic AggregationSpELExpressionexpressionOf(String expressionString, Object... parameters) Creates newAggregationSpELExpressionfor the given expressionString and parameters.toDocument(AggregationOperationContext context) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AggregationExpression
toDocument
-
Method Details
-
expressionOf
Creates newAggregationSpELExpressionfor the given expressionString and parameters.- Parameters:
expressionString- must not be null.parameters- can be empty.- Returns:
- new instance of
AggregationSpELExpression.
-
toDocument
Description copied from interface:AggregationExpression- Specified by:
toDocumentin interfaceAggregationExpression- Parameters:
context- must not be null.- Returns:
- the MongoDB native (
Document) form of the expression.
-