When inserting a document into a MongoDB database with MongoDB Compass how do I insert the current date?
I have tried like so:
But as you can see there is an error.
How do I insert the current date using MongoDB Compass?
Try like this:
{
"type":"grunt",
"last_used": {
"$date": "2018-04-15T16:54:40.000Z"
},
"created_at": {
"$date": "2018-04-15T16:54:40.000Z"
}
}
Try like this:
2016-01-24T13:21:55.000
Try like this
{
"type": "grunt",
"last_used": {"$date":{"$numberLong":"1602720972129"}},
"created_at":{"$date":{"$numberLong":"1602720972129"}}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With