Description
This is a first-timers-only
issue.
This means we've worked to make it more legible to folks who either haven't contributed to our codebase before or even folks who haven't contributed to open source before.
If that's you, we're interested in helping you take the first step and can answer questions and help you out as you do. Note that we're especially interested in contributions from people from groups underrepresented in free and open source software!
If you have contributed before, consider leaving this one for someone new, and looking through our general ideal-for-contribution
issues.
Thanks!
Problem
MongoDB 4.4.2 introduced a new aggregation operator $rand
that we want to support via the Aggregation Framework.
Details about the operator can be found within the MongoDB Reference Documentation.
Solution
Introduce MathOperators
to the org.springframework.data.mongodb.core.aggregation
package and add a Rand
type that implements AggregationExpression
. You may want to have a look at ArithmeticOperators
to get an impression what this could look like.
Update org.springframework.data.mongodb.core.spel.MethodReferenceNode
to add SpEL support for the operator via a rand()
method.
Make sure to provide tests that assert the expression can be used within an pipeline and produces the desired command.
Again you may want to have a look at existing examples (eg. ArithmeticOperatorsUnitTests
& SpelExpressionTransformerUnitTests
).
Steps to Fix
- Claim this issue with a comment below and ask any clarifying questions you need
- Set up a repository locally following the Contributing Guidelines
- Try to fix the issue following the steps above
- Commit your changes and create a pull request