diff --git a/lib/change_stream.js b/lib/change_stream.js index 21f2428542..7d40eb6075 100644 --- a/lib/change_stream.js +++ b/lib/change_stream.js @@ -453,6 +453,10 @@ function processNewChange(args) { changeStream.resumeToken = change._id; + // wipe the startAtOperationTime if there was one so that there won't be a conflict + // between resumeToken and startAtOperationTime if we need to reconnect the cursor + changeStream.options.startAtOperationTime = undefined; + // Return the change if (eventEmitter) return changeStream.emit('change', change); if (typeof callback === 'function') return callback(error, change);