My debugging Steps:
- Added a cron (every 5 min) job that inserts (key : watchID val : “randomString”) a document into the collection which has an watch applied on it.
- Then listened for the insert event with the watchID key.
- Logged every time the watch was active.
When comparing the last log entry with the MongoDB server Metrics
I found the restarting and the election of the new Primary may be the cause.
Atlas UI showing change of primary and server restart
How to get events after the server has undergone restart or election or both.