spring-data-mongodb
spring-data-mongodb copied to clipboard
Introduce AggregationStage API
This PR does two things
- 1st we make sure to use available pipeline stages to figure out the operation in use to avoid running into an exception if
toDocumentdoes not return anything becausetoPipelineStagesdoes. - 2nd new it introduces new API intended to replace
AggregationOperationwithAggregationStagethat does not suffer the problem outlined in #4306 and moves us closer to MongoDB terminology, reducing cognitive overload. Thedefaultmethod arrangement also allowed to remove the deprecation warning withinAggregationOperation.
Introducing AggregationStage and a multi-document variant of that interface makes a lot of sense. In the light of our existing component it becomes obvious that we've mixed several concepts that are orthogonal (field-exposing operation that is a multi-document stage). We should revise our aggregation framework setup to let simple stages implement AggregationStage an decouple e.g. FieldsExposingAggregationOperation from AggregationStage.