Operational Defect Database

BugZero found this defect 2494 days ago.

MongoDB | 377796

[SERVER-28982] $currentDate modifiers should not use LogicalClock as source

Last update date:


Affected products:

MongoDB Server

Affected releases:


Fixed releases:

No fixed releases provided.



Esepcially when we switch the time to be purely logical. Here are the instances in the code that needs to be fixed: https://github.com/mongodb/mongo/blob/r3.5.6/src/mongo/db/ops/modifier_current_date.cpp#L232 https://github.com/mongodb/mongo/blob/r3.5.6/src/mongo/db/ops/modifier_object_replace.cpp#L61 https://github.com/mongodb/mongo/blob/r3.5.6/src/mongo/db/ops/insert.cpp#L170 Implementation should provide backwards compatible behavior where the generated Timestamps are always unique.

Top User Comments

asya commented on Fri, 31 Jul 2020 17:39:11 +0000: We're moving away from $currentDate since we added "$$NOW" to agg, is this ticket still relevant? SERVER-23656 sheeri.cabral commented on Thu, 9 Jan 2020 14:08:25 +0000: I feel the query team should determine whether subsystems using $currentDate should rely on it to be unique, and then we can figure out what to do from there. $currentDate modifiers should be based on actual clock, not logical clock. tess.avitabile commented on Mon, 26 Jun 2017 20:13:16 +0000: If this work is done after SERVER-28766, be sure to change CurrentDateNode. misha.tyulenev commented on Fri, 23 Jun 2017 21:41:59 +0000: While testing the changes realized that its not safe because there is no uniqueness guarantees. It may affect tools like mongooplog that insert currentDate into oplog. renctan commented on Wed, 26 Apr 2017 21:30:58 +0000: They should be using something that is closely tied to the physical clock of the server, like one of the ClockSource from the ServiceContext. misha.tyulenev commented on Wed, 26 Apr 2017 21:19:27 +0000: renctan Can you please clarify what should be used instead?

Additional Resources / Links


BugZero Risk Score

Coming soon



Have you been affected by this bug?


Do you know how much operational outages are costing you?

Understand the cost to your business and how BugZero can help you reduce those costs.


Login to read and write comments.

Have you ever...

had your data corrupted from a