spring-data-mongodb icon indicating copy to clipboard operation
spring-data-mongodb copied to clipboard

Improve usage experience of `AggregationExpression` factories

Open mp911de opened this issue 2 years ago • 0 comments

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.

mp911de avatar Aug 17 '23 12:08 mp911de