db.collection.findOne()._id
_id.getTimestamp()
Hi Praneeth,
I believe in MongoDB 4.0, the mongod log is the only place where this information is recorded. For example:
2018-07-24T15:34:57.847+1000 I STORAGE [conn8] createCollection: test.test with generated UUID: 9ca87591-a85b-444b-8713-ff85b4f67b9f
The log timestamp shows the time when the test collection inside the test database was created.
The _id timestamp you mentioned is only valid for an automatically generated ObjectId, and is valid for the creation timestamp of a single document. It looks like that you have a custom _id field, which is why you’re seeing that error.
Alternatively, your application might insert a timestamp into a separate collection when a new collection of interest is created.
Best regards,
Kevin