Skip to content

Commit

Permalink
fix killCursor issue
Browse files Browse the repository at this point in the history
  • Loading branch information
emadum committed Jun 22, 2021
1 parent 6ba3593 commit 9cade0d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/core/wireprotocol/kill_cursors.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ const maxWireVersion = require('../utils').maxWireVersion;
const emitWarning = require('../utils').emitWarning;
const command = require('./command');

function killCursors(server, ns, cursorState, options, callback) {
function killCursors(server, ns, cursorState, defaultOptions, callback) {
if (typeof defaultOptions === 'function') {
callback = defaultOptions;
defaultOptions = {};
}
callback = typeof callback === 'function' ? callback : () => {};
options = options || {};

const cursorId = cursorState.cursorId;

Expand Down Expand Up @@ -47,6 +50,7 @@ function killCursors(server, ns, cursorState, options, callback) {
cursors: [cursorId]
};

const options = defaultOptions || {};
if (typeof cursorState.session === 'object') options.session = cursorState.session;

command(server, ns, killCursorCmd, options, (err, result) => {
Expand Down

0 comments on commit 9cade0d

Please sign in to comment.