MongoDB Compass - How To Insert Date Type?

BugHunterUK picture BugHunterUK · Apr 15, 2018 · Viewed 8.6k times · Source

When inserting a document into a MongoDB database with MongoDB Compass how do I insert the current date?

I have tried like so:

enter image description here

But as you can see there is an error.

How do I insert the current date using MongoDB Compass?

Answer

tatsuya picture tatsuya · Jul 31, 2018

Try like this:

2016-01-24T13:21:55.000