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

Querying with millisecond precision doesn't work

    • Type: Icon: Task Task
    • Resolution: Done
    • 3.0.14
    • Affects Version/s: None
    • Component/s: None
    • None

      I have an object that is stored in the database with millisecond precision:

      "requested_at" : ISODate("2012-11-21T22:44:00.942Z")

      When I write a query to find the next object with a greater date it fails:

      Request.where(:requested_at.gt => r.requested_at).order_by(requested_at: :asc).limit(1).first

      The object returned is the same as r that is used in the query. r presents itself as a DateTime and it either doesn't have ms precision or it is being ignored:

      1.9.3-p194 :029 > r.requested_at.utc
      => Wed, 21 Nov 2012 22:44:00 +0000

            Assignee:
            Unassigned Unassigned
            Reporter:
            dnd Steve
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: