feature(aggregate): added support for 2 additional use-cases while ma… #316
+19
−20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes Made
Added new optional param to aggregate function to support more use-cases
Potential Risks
The assumptions in usage scenario 1 are the same as for 2. In both cases, there's still room for user error, if the user does not consider the established assumptions adequately.
The 3rd scenario can lead to even more user errors since the user must be aware that he may be providing additional steps to the pipeline after the pagination operations and as such must take into consideration any prior data transformations. Ultimately, in this scenario, the user could even override the $sort assumption so only advanced users should use it.
Test Plan
The performance implications are directly related with the pipeline data transformation/summarization steps prior to the pagination steps and those that follow for both scenarios 2) and 3) respectively
Checklist
Sorry but at this time I don't have the time to add any additional meaningful tests for the new sample use cases. The changes are "minimal" and I'm convinced that added usefulness at this point suffice to justify this addition even though the additional tests could be helpful even if to explain the use cases better with practical examples.
I've attested though that all previous tests still succeed.