What is the best way to format a date in JSON for Mongo DB storage

Posted by Poul on Stack Overflow See other posts from Stack Overflow or by Poul
Published on 2010-04-01T17:09:40Z Indexed on 2010/04/01 17:13 UTC
Read the original article Hit count: 354

Filed under:
|
|

I have a date with a time. I'm using ruby, but the language shouldn't matter.

d = "2010-04-01 13:00:00"

What is the best way to format this date for Mongo DB? By 'best' I mean, is there a certain format I could use where Mongo would recognize it as a date and might give me more-advanced filtering optons?

ie: If formatted correctly, could I ask Mongo to return all records whose month is '04'?

Thanks!

© Stack Overflow or respective owner

Related posts about JSON

Related posts about mongodb