org.springframework.data.mongodb.core.aggregation

Class AggregationSpELExpression

  • java.lang.Object
    • org.springframework.data.mongodb.core.aggregation.AggregationSpELExpression
  • All Implemented Interfaces:
    AggregationExpression


    public class AggregationSpELExpression
    extends Object
    implements AggregationExpression
    An 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:
    SpelExpressionTransformer