Watch keynotes and sessions from MongoDB.live, our virtual developer conference.

Incorrect date & time recorded

Greetings!
I am currently investigating an issue where some documents have incorrect values in the ‘date’ field. I have put a TTL index on the field (10 min.). I have found documents to be missing in the collection after refreshing Compass less than a minute after the documents are inserted (some even don’t appear in the collection after insertion at all!). I managed to see the values of the ‘date’ field on some of these documents before their deletion and their values are inaccurate by 10-20 minutes which explains why they were deleted. I plan to changed the TTL duration to 2 days for now.

I have confirmed my machine (Ubuntu 18.04) built-in time-synchronization tool ( timesyncd) is turned on. What other reasons can cause this problem? (note: this problem doesn’t occur all the time, just sometimes – but frequently enough it has caught my attention). I use JavaScript’s new Date() to create the values