From 4d45c8a23fba8c03a2d2f24d39ded3dc41308bc1 Mon Sep 17 00:00:00 2001 From: Matt Broadstone Date: Tue, 16 Jul 2019 08:03:48 -0400 Subject: [PATCH] fix(read-operations): send sessions on all read operations Somewhere during the wire protocol refactor we lost support for sending `lsid` on read operations. This commit reintroduces support for sessions in all of these code paths. --- lib/core/wireprotocol/get_more.js | 4 ++++ lib/core/wireprotocol/query.js | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/core/wireprotocol/get_more.js b/lib/core/wireprotocol/get_more.js index ec9cd6abe4..b2db320265 100644 --- a/lib/core/wireprotocol/get_more.js +++ b/lib/core/wireprotocol/get_more.js @@ -80,6 +80,10 @@ function getMore(server, ns, cursorState, batchSize, options, callback) { options ); + if (cursorState.session) { + commandOptions.session = cursorState.session; + } + command(server, ns, getMoreCmd, commandOptions, queryCallback); } diff --git a/lib/core/wireprotocol/query.js b/lib/core/wireprotocol/query.js index 0a45af2154..c501b50644 100644 --- a/lib/core/wireprotocol/query.js +++ b/lib/core/wireprotocol/query.js @@ -46,7 +46,14 @@ function query(server, ns, cmd, cursorState, options, callback) { options ); - if (cmd.readPreference) commandOptions.readPreference = readPreference; + if (cmd.readPreference) { + commandOptions.readPreference = readPreference; + } + + if (cursorState.session) { + commandOptions.session = cursorState.session; + } + command(server, ns, findCmd, commandOptions, callback); }