Mongodb 3.6 changestream resumeToken timestamp

496 views Asked by At

I am currently using changestream feature of MongoDB 3.6

We are a heavy update/insert operation and we use changestream to send data for analytics. We need to sync the data in the realtime but since resumeToken is binary, I have hard time finding the timestamp of the operation and hence can't calculate the synchronization lag to analytics.

Is there any way to fetch timestamp from resumeToken or any other way to fetch the operation timestamp.

1

There are 1 answers

1
Wan B. On

Is there any way to fetch timestamp from resumeToken or any other way to fetch the operation timestamp.

You can't find out the timestamp of the operation in MongoDB 3.6. There is a plan to add a tool to inspect resumeToken binary to decode it into something useful outside of the server : SERVER-32283.

In MongoDB 4.0 however, every Change Streams event will also include a field called clusterTime, which is the timestamp of the oplog entry associated with the event. See also change events.