Skip to content

Commit

Permalink
fix(cursor): don't use other operation's session for cloned cursor op…
Browse files Browse the repository at this point in the history
…eration (#2705)

NODE-3008
  • Loading branch information
KonanMentor authored Jan 29, 2021
1 parent f89e4c1 commit 8082c89
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/core/cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const executeOperation = require('../operations/execute_operation');
const Readable = require('stream').Readable;
const SUPPORTS = require('../utils').SUPPORTS;
const MongoDBNamespace = require('../utils').MongoDBNamespace;
const mergeOptions = require('../utils').mergeOptions;
const OperationBase = require('../operations/operation').OperationBase;

const BSON = retrieveBSON();
Expand Down Expand Up @@ -207,7 +208,9 @@ class CoreCursor extends Readable {
* @return {Cursor}
*/
clone() {
return this.topology.cursor(this.ns, this.cmd, this.options);
const clonedOptions = mergeOptions({}, this.options);
delete clonedOptions.session;
return this.topology.cursor(this.ns, this.cmd, clonedOptions);
}

/**
Expand Down

0 comments on commit 8082c89

Please sign in to comment.