Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to make unique Timestamp within transaction or batch write

I’ve noticed many times that transaction or batch write with many documents at once creating documents with the same Timestamp .

How could i prevent that ?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

This is actually by design, all writes in a transaction happen at the logically same time. There is no way to configure this behavior.

If you want each write to have a different timestamp you will have to pass a timestamp value from the client (instead of letting the server determine the value), or you will have to perform (some of) the writes outside of the transaction.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading