I have a NodeJS application which listens to change stream events. One thing I noticed is that when listening to the ‘resumeTokenChanged’ on one DB, I get events almost every second even though there are no activities done on the collection, while on another DB I will not get any ‘resumeTokenChanged’ events if there are no activities on the collection.
When a resume token is changed, I will store it in the DB so that I can resume the change stream in case my application crashes. I have several collections which have low activity on it, so I’m listening to the ‘resumeTokenChanged’ event to store the latest resume token for that collection. If I do not do this, the resume token I get from a change event might roll off the oplog after awhile, then resuming the change stream will fail.
I need to have the behavior of the first DB. Any idea why the difference in behavior between the two DBs? Both DBs are the same version 4.0.14.
I appreciate if anyone can help, thank you!