MongoDB ruby dates

Posted by MB on Stack Overflow See other posts from Stack Overflow or by MB
Published on 2010-04-17T16:36:03Z Indexed on 2010/04/17 16:43 UTC
Read the original article Hit count: 285

Filed under:
|
|
|

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

© Stack Overflow or respective owner

Related posts about mongodb

Related posts about mongoid