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

Fix & integration test querying by TimeWithZone via driver

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 7.1.0.rc0, 7.0.6
    • Affects Version/s: None
    • Component/s: Query

      We need to have a test in Mongoid that sends a query on a (driver) collection using a TimeWithZone object like this:

      good_time = Time.now
      bad_time = Time.now.in_time_zone("Pacific Time (US & Canada)")
      User.collection.find(:u_at => {:$lt => bad_time}).to_a.length # this query will be wrong
      
      # the problem is that:
      good_time.to_bson != bad_time.to_bson
      

      ... and verifies correct results.

      As well, Mongoid will need to require 'bson/active_support' as added in https://github.com/mongodb/bson-ruby/pull/104.

      These changes should be backported to 6 and 7 stable branches.

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: