Assigning a unique timestamp on creation or updation of document

What’s the best way to assign a unique timestamp whenever the document is created or updated ?

Client(s) can use that timestamp to get the updated / new documents from the last timestamp.

Hi @Shanth_Kumar_Khandre,

It depends what version of the server you are using.

Prior to 4.2 you should use $currentDate operator , but starting 4.2 you can use $$NOW or $$CLUSTER_TIME:


1 Like