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 Jun 21, 2019
1 parent 9cde4b9 commit 362afd8
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 @@ -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);
Expand Down

0 comments on commit 362afd8

Please sign in to comment.