-
Notifications
You must be signed in to change notification settings - Fork 16
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
Implement $min and $max update operators #233
Conversation
* then recursively by value; and if first N fields the same, Object with more properties is sorted | ||
* last. | ||
*/ | ||
public class JsonNodeComparator implements Comparator<JsonNode> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. In memory sort made easy with this utility class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, was about to suggest just that, was thinking about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. In memory sort made easy with this utility class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. In memory sort made easy with this utility class.
"updateOne": { | ||
"filter" : {"_id" : "update_doc_min"}, | ||
"update" : {"$min" : { | ||
"min": 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to have an integration test that uses $min
and $max
with types that aren't numbers. For example, $min: { foo: 'bar' }
. That should work given the JsonNodeComparatorTest.java
tests, but I think it's worth checking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. I did add unit tests for wider range given they are more compact, but yeah I could/should add at least one cross-type, and one non-number IT operation.
What this PR does:
Adds
$min
and$max
update operatorsWhich issue(s) this PR fixes:
Fixes #223
Checklist