Add Feature Flag: _matches? should use millisecond precision when comparing Time objects

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 7.4.0
    • Affects Version/s: None
    • Component/s: None
    • Fully Compatible
    • None
    • None
    • None
    • None
    • None
    • None

      Per https://docs.mongodb.com/ruby-driver/current/tutorials/bson-v4/#time-instances,

      > Times in BSON (and MongoDB) can only have millisecond precision. When Ruby Time instances are serialized to BSON or Extended JSON, the times are floored to the nearest millisecond.
      > Because of this flooring, applications are strongly recommended to perform all time calculations using integer math, as inexactness of floating point calculations may produce unexpected results.

      Yet _matches? doesn't apply that logic, which means it can be inaccurate.

      https://github.com/mongodb/mongoid/pull/5094 should address this.

              Assignee:
              Neil Shweky (Inactive)
              Reporter:
              Jon Hyman
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: