I was looking at the change stream and read some posts around about the use of the resume token. There is an option to resume after a token and docs say that this is a way not to miss events in case the listener crashes. What I don’t completely understand is if the resume token is ‘some way’ monotonically strictly crescent. I mean, I assume that oplog has its ordering and the resume after should take advantage of it, but I don’t understand if the timestamp that’s in the token provides this or still you can have more entries with same timestamp and as such not really ordered. But in case of collisions what happens. Below a snippet from a go lib (GitHub - mongodb-js/mongodb-resumetoken-decoder: A library for decoding MongoDB resume tokens) that shows the components of the token.
{
timestamp: new Timestamp({ t: 1630438675, i: 1 }),
version: 1,
tokenType: 128,
txnOpIndex: 0,
fromInvalidate: false,
uuid: new UUID("a5093abb-38fe-4b9e-a67f-01bb1a96d812"),
documentKey: { _id: '___x' }
}
Appreciate if someone can shed some light on this.