From 60c0b221d75fce34afc06d852fa81245fc8e5133 Mon Sep 17 00:00:00 2001 From: Neal Beeken Date: Wed, 17 Feb 2021 14:25:23 -0500 Subject: [PATCH] Move session support check into server selection for unified topology --- lib/operations/execute_operation.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/operations/execute_operation.js b/lib/operations/execute_operation.js index 10432e11a7..f7fb0f53be 100644 --- a/lib/operations/execute_operation.js +++ b/lib/operations/execute_operation.js @@ -142,6 +142,10 @@ function executeWithServerSelection(topology, operation, callback) { return; } + if (serverSelectionOptions.session && topology.hasSessionSupport()) { + return callback(new MongoError('Current topology does not support sessions')); + } + const shouldRetryReads = topology.s.options.retryReads !== false && operation.session &&