From f9e786a338555017cbb3083382bbf82007bba1dc Mon Sep 17 00:00:00 2001 From: Matt Broadstone Date: Wed, 8 Apr 2020 10:15:47 -0400 Subject: [PATCH] fix: always return empty array for selection on unknown topology Topology types of `Unknown` should always return an empty set of servers for server selection using a read preference NODE-2549 --- lib/core/sdam/server_selection.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/core/sdam/server_selection.js b/lib/core/sdam/server_selection.js index 5647f941c8..46657d3969 100644 --- a/lib/core/sdam/server_selection.js +++ b/lib/core/sdam/server_selection.js @@ -186,6 +186,10 @@ function readPreferenceServerSelector(readPreference) { ); } + if (topologyDescription.type === TopologyType.Unknown) { + return []; + } + if ( topologyDescription.type === TopologyType.Single || topologyDescription.type === TopologyType.Sharded