spring-projects / spring-projects/spring-data-mongodb
Improve usage experience of `AggregationExpression` factories
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the factory signatures in SetOperators, DateOperators, and other AggregationExpression factories, focusing on where String field references and AggregationExpression values are accepted. Review AggregationVariable and Field usage to determine the relevant overloads. Done means callers can pass Variable.VALUE or Variable.THIS directly instead of calling getTarget, with the affected aggregation behavior covered by the project’s existing tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, mongodb
- Domain
- backend-api-design, databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100