spring-data-mongodb
spring-data-mongodb copied to clipboard
Improve usage experience of `AggregationExpression` factories
SetOperators, DateOperators and other factories to create aggregation expressions accept either String field references or AggregationExpressions.
With the evolution of AggregationVariable, that is a Field, calling code has to unwrap the variable target:
SetUnion.arrayAsSet(Variable.VALUE.getTarget()).union(Variable.THIS.getTarget())
It would be much nicer to drop getTarget and simply use Variable.VALUE/Variable.THIS:
SetUnion.arrayAsSet(Variable.VALUE).union(Variable.THIS)
One approach to achieve this could be accepting Field/Field... in places where we accept a String field reference.