I have a java code that is inserting an object into a collection in Mongo DB. While I insert this new object (details of the object given below), I need to also insert a creation date. What's the best way to handle this? Since we have different time zones, I want to make sure that I am following the correct approach for saving and reading the date fields.
document structure: I need to have my java code create a system date that would insert the creation date into Mongo DB in a proper format.
{ "_id" : ObjectId("568ac782e4b0fbb00e4f1e45"), "cat" : "Abc", "name" : "testName" }
Please advise.
ObjectIdhas agetDate()method which returns insert data