use of dev.morphia.aggregation.experimental.expressions.impls.Expression in project morphia by mongodb.
the class Filters method expr.
/**
* Allows use of aggregation expressions within the query language.
*
* @param expression the expression to evaluate
* @return the filter
* @query.filter $expr
*/
public static Filter expr(Expression expression) {
return new Filter("$expr", null, expression) {
@Override
public void encode(Datastore datastore, BsonWriter writer, EncoderContext context) {
writer.writeName("$expr");
Expression value = getValue();
if (value != null) {
wrapExpression(datastore, writer, value, context);
} else {
writer.writeNull();
}
}
@Override
public Expression getValue() {
return (Expression) super.getValue();
}
};
}
Aggregations