I would recommend not using Date
, but DateTime
instead:
field :set_date, :type => DateTime
Now it will not only be saved in 1 field, for example:
"set_date" : ISODate("2012-03-14T17:42:27Z")
But Mongoid will correctly handle the various transformations for the queries as you want:
SimpleAction.where( :set_date => { :$lte => Date.today } )
source share