Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce AggregationStage API #4309

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Introduce AggregationStage API #4309

wants to merge 3 commits into from

Conversation

christophstrobl
Copy link
Member

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 toDocument does not return anything because toPipelineStages does.
  • 2nd new it introduces new API intended to replace AggregationOperation with AggregationStage that does not suffer the problem outlined in AggregationOperation::toDocument method is deprecated, but MongoTemplate still uses it #4306 and moves us closer to MongoDB terminology, reducing cognitive overload. The default method arrangement also allowed to remove the deprecation warning within AggregationOperation.

This commit makes sure to use available pipeline stages to figure out the operation.
With the introduction of AggregationStage we move the API closer to the MongoDB terminology removing kognitive overhead.
Also the change allows us to switch back and forth with the default implementations of toDocument and toDocuments which let's us remove the deprecation warnings having dedicated interfaces that indicate what to implement in order to comply with the usage pattern.
@mp911de mp911de added the status: on-hold We cannot start working on this issue yet label Mar 16, 2023
@mp911de
Copy link
Member

mp911de commented Mar 16, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: on-hold We cannot start working on this issue yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AggregationOperation::toDocument method is deprecated, but MongoTemplate still uses it
2 participants