Skip to content

Commit 869b187

Browse files
author
Thomas Reggi
committed
capture the delebrate value of directConnection and use it for deciding to use sharded topology
1 parent c651fbe commit 869b187

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/core/sdam/topology_description.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class TopologyDescription {
151151
// update the actual server description
152152
serverDescriptions.set(address, serverDescription);
153153

154-
if (serverType === ServerType.Mongos && this.s.options.directConnection === false) {
154+
if (serverType === ServerType.Mongos && this.options._directConnection === false) {
155155
return new TopologyDescription(
156156
TopologyType.Sharded,
157157
serverDescriptions,

lib/core/uri_parser.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,8 @@ function parseConnectionString(uri, options, callback) {
687687
return callback(new MongoParseError('directConnection option requires exactly one host'));
688688
}
689689

690+
parsedOptions._directConnection = Boolean(parsedOptions.directConnection);
691+
690692
// NOTE: this behavior will go away in v4.0, we will always auto discover there
691693
if (
692694
parsedOptions.directConnection == null &&

0 commit comments

Comments
 (0)