Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-5237

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

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

      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@mongodb.com Neil Shweky (Inactive)
            Reporter:
            jon@braze.com Jon Hyman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: