How to insert a document with date in mongo?
The standard driver takes java.util.date types and serializes as BSON dates. So with a collection object to “example” Date now = new Date(); BasicDBObject timeNow = new BasicDBObject(“date”, now); example.insert(timeNow); If you are looking for a way to use the “server” time in operations, there is the $currentDate operator, but this works with “updates”, so … Read more