From e855c83d8b73f4ce57a11193a1e52461ab2cd4db Mon Sep 17 00:00:00 2001 From: Matt Broadstone Date: Tue, 11 Feb 2020 08:53:25 -0500 Subject: [PATCH] fix: pass options into `commandSupportsReadConcern` --- lib/core/sessions.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/core/sessions.js b/lib/core/sessions.js index ff5268039d..672c8082ec 100644 --- a/lib/core/sessions.js +++ b/lib/core/sessions.js @@ -661,7 +661,12 @@ function commandSupportsReadConcern(command, options) { return true; } - if (command.mapReduce && options.out && (options.out.inline === 1 || options.out === 'inline')) { + if ( + command.mapReduce && + options && + options.out && + (options.out.inline === 1 || options.out === 'inline') + ) { return true; } @@ -692,7 +697,7 @@ function applySession(session, command, options) { // first apply non-transaction-specific sessions data const inTransaction = session.inTransaction() || isTransactionCommand(command); const isRetryableWrite = options.willRetryWrite; - const shouldApplyReadConcern = commandSupportsReadConcern(command); + const shouldApplyReadConcern = commandSupportsReadConcern(command, options); if (serverSession.txnNumber && (isRetryableWrite || inTransaction)) { command.txnNumber = BSON.Long.fromNumber(serverSession.txnNumber);