diff --git a/lib/connection_string.js b/lib/connection_string.js index 622fc2c8c2..7608399230 100644 --- a/lib/connection_string.js +++ b/lib/connection_string.js @@ -720,14 +720,6 @@ function parseConnectionString(uri, options, callback) { return callback(new MongoParseError('directConnection option requires exactly one host')); } - // NOTE: this behavior will go away in v4.0, we will always auto discover there - if ( - parsedOptions.directConnection == null && - hosts.length === 1 && - parsedOptions.replicaSet == null - ) { - parsedOptions.directConnection = true; - } const result = { hosts: hosts, diff --git a/lib/sdam/server_selection.js b/lib/sdam/server_selection.js index bfa33f07e9..d34387d687 100644 --- a/lib/sdam/server_selection.js +++ b/lib/sdam/server_selection.js @@ -187,6 +187,10 @@ function readPreferenceServerSelector(readPreference) { ); } + if (topologyDescription.type === TopologyType.Unknown) { + return []; + } + if ( topologyDescription.type === TopologyType.Single || topologyDescription.type === TopologyType.Sharded