Skip to content

Commit

Permalink
fix(change-streams): don't copy irrelevant resume options
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst authored and daprahamian committed Aug 13, 2019
1 parent f6dd6c9 commit f190072
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/change_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,14 @@ class ChangeStreamCursor extends Cursor {
if (this.options[optionName]) result[optionName] = this.options[optionName];
}

if (this.resumeToken) {
Object.assign(result, { resumeAfter: this.resumeToken });
} else if (this.startAtOperationTime && maxWireVersion(this.server) >= 7) {
Object.assign(result, { startAtOperationTime: this.startAtOperationTime });
if (this.resumeToken || this.startAtOperationTime) {
['resumeAfter', 'startAfter', 'startAtOperationTime'].forEach(key => delete result[key]);

if (this.resumeToken) {
result.resumeAfter = this.resumeToken;
} else if (this.startAtOperationTime && maxWireVersion(this.server) >= 7) {
result.startAtOperationTime = this.startAtOperationTime;
}
}

return result;
Expand Down

0 comments on commit f190072

Please sign in to comment.