-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fix Time comparisons with _matches? to use millisecond precision. #5094
Conversation
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.
@jonhyman Thank you for the PR! It looks good except I think the array comparisons should be subject to the same time comparison logic as the scalars, do you agree?
@jonhyman can you also please merge master into this PR, it's based on a very old master. |
Master is merged in. |
…ngodb#5094) Co-authored-by: Jason Penny <[email protected]> Co-authored-by: Dmitry Rybakov <[email protected]>
@jonhyman @jasonpenny Thank you for the contribution! |
Updates
_matches?
to compare Time objects using millisecond precision like what MongoDB does. We have a selector that returns a result that doesn't meet_matches?
because of nanosecond rounding. This pull does something similar to what the bson-ruby gem does at https://github.com/mongodb/bson-ruby/blob/master/lib/bson/time.rb#L57 and compares Time objects using millisecond precision.Per https://docs.mongodb.com/ruby-driver/current/tutorials/bson-v4/#time-instances,