Skip to content

Commit

Permalink
fix(ChangeStream): remove startAtOperationTime once we have resumeToken
Browse files Browse the repository at this point in the history
Removes startAtOperationTime once we have a resumeToken to prevent it from being sent when attempting to resume.

Fixes NODE-2022
  • Loading branch information
timjnh authored and daprahamian committed Aug 13, 2019
1 parent c9dc717 commit 8d27e6e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/change_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8d27e6e

Please sign in to comment.