Support for aggregation pipeline projection expressions #667
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.
This is a patch to the
Projections
class which provides the option to build projection expressions which take lists of arguments, such as$add
and$multiply
.I've tried to follow the style of the
Group
support for expressions, although I haven't implemented the analogue of theAccumulator
class, as I wasn't sure how to approach nested projection expressions.The type of the arguments to the expressions are not defined: just an
Object
list. This may need some improvement, but again, I'm not sure how to approach interchangeable field references, number literals and nested expressions.A new test is included, which verifies that the
$divide
expression works as expected. Other expressions follow the same structure, and should be equivalent.I've run
gradlew check
, which passes the style checks and the new unit test - let me know if you need anything else, or more tests.Regards,
Mike.