views:

60

answers:

0
+1  Q: 

MongoDB ruby dates

I have a collection with an index on :created_at (which in this particular case should be a date)

From rails what is the proper way to save an entry and then retrieve it by the date?

I'm trying something like:

Model: field :created_at, :type => Time

script:

Col.create(:created_at => Time.parse(another_model.created_at).to_s

and

Col.find(:all, :conditions => { :created_at => Time.parse(same thing) })

and it's not returning anything