What is the syntax of dates in MongoDB running on MongoLab?

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

+5
source share
2 answers

If you use one of the drivers, you create a date through this Date Language class. For example, in Javascript (for example, Node.js) it will be "new date (11,11,11)". If you are using the MongoLab REST API or the admin user interface, you represent dates with this syntax:

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

, :

"dateAdded": {
   "$date": "2012-07-30T15:26:15.321Z"
}

, , :

{
    "dateAdded": {
        "$gt": {
            "$date": "2012-07-28T23:07:11Z"
        }
    }
}
+5

All Articles