From 8d27e6e5e7c10a6317a054508f0361d9e3d363a4 Mon Sep 17 00:00:00 2001 From: Tim Jones Date: Fri, 21 Jun 2019 16:33:42 -0400 Subject: [PATCH] fix(ChangeStream): remove startAtOperationTime once we have resumeToken Removes startAtOperationTime once we have a resumeToken to prevent it from being sent when attempting to resume. Fixes NODE-2022 --- lib/change_stream.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/change_stream.js b/lib/change_stream.js index 10e0e34f1b..a0d4792dbc 100644 --- a/lib/change_stream.js +++ b/lib/change_stream.js @@ -447,6 +447,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);