What is the syntax for Dates in MongoDB running on MongoLab?

SomethingOn picture SomethingOn · Nov 4, 2011 · Viewed 7.5k times · Source

Instead of ObjectId('82he921he982he82') its "_id":{"$oid":"82he921he982he82"} for object Ids, but I have no idea how to create a date value in a document on MongoLab :s

Answer

will picture will · Nov 4, 2011

If you are using one of the drivers, you create a date via that language's Date class. For instance, in Javascript (like Node.js) it would be 'new Date(11,11,11)'. If using the MongoLab REST API or admin UI you represent dates with this syntax:

  { "$date": "2010-10-28T23:07:11Z" }