Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

Commit

Permalink
feat(session): allow session options to be passed to write cmds
Browse files Browse the repository at this point in the history
NODE-1088
  • Loading branch information
mbroadst committed Oct 6, 2017
1 parent e3a1c8b commit 5da75e4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/topologies/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,8 @@ Server.prototype.command = function(ns, cmd, options, callback) {
monitoring: typeof options.monitoring === 'boolean' ? options.monitoring : false,
fullResult: typeof options.fullResult === 'boolean' ? options.fullResult : false,
requestId: query.requestId,
socketTimeout: typeof options.socketTimeout === 'number' ? options.socketTimeout : null
socketTimeout: typeof options.socketTimeout === 'number' ? options.socketTimeout : null,
session: options.session || null
};

// Write the operation to the pool
Expand Down
1 change: 1 addition & 0 deletions lib/wireprotocol/2_6_support.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ var executeWrite = function(pool, bson, type, opsField, ns, ops, options, callba

// Options object
var opts = { command: true };
if (typeof options.session !== 'undefined') opts.session = options.session;
var queryOptions = { checkKeys: false, numberToSkip: 0, numberToReturn: 1 };
if (type === 'insert') queryOptions.checkKeys = true;
if (typeof options.checkKeys === 'boolean') queryOptions.checkKeys = options.checkKeys;
Expand Down
1 change: 1 addition & 0 deletions lib/wireprotocol/3_2_support.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ var executeWrite = function(pool, bson, type, opsField, ns, ops, options, callba

// Options object
var opts = { command: true };
if (typeof options.session !== 'undefined') opts.session = options.session;
var queryOptions = { checkKeys: false, numberToSkip: 0, numberToReturn: 1 };
if (type === 'insert') queryOptions.checkKeys = true;
if (typeof options.checkKeys === 'boolean') queryOptions.checkKeys = options.checkKeys;
Expand Down

0 comments on commit 5da75e4

Please sign in to comment.