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

Query by date with milliseconds

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 5.0.2
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      I have this date: 2014-04-19T13:21:16.194Z
      and a model with a Time field:

      class Foo
        include Mongoid::Document
        field :date, type: Time
      end
      

      Now I query by this field:

      foo_date = Time.parse(params[:d])
      @foo= Foo.where(:date.gt => foo_date)
      

      Here is the issue, the query done is:

      Unable to find source-code formatter for language: shell. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      ... selector={"foo.date"=>{"$gt"=>2014-04-19 11:21:16 UTC}} ...
      

      And the usec: .194 was missed.
      How can I query by the complete date?

            Assignee:
            Unassigned Unassigned
            Reporter:
            Vrael Vrael [X]
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: