-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.6.3, 4.0.0
-
Component/s: Shell
-
None
If I start a replset without calling `rs.initiate` then the node driver gives me a server selection timeout error when using { useUnifiedTopology: true }.
Steps to start server:
rm -rf testdata0
mkdir -p testdata0/rs0-0 testdata0/rs0-1 testdata0/rs0-2
/opt/mongodb-osx-x86_64-enterprise-4.4.1/bin/mongod --port 27017 --dbpath=testdata0/rs0-0 --replSet=rs0
/opt/mongodb-osx-x86_64-enterprise-4.4.1/bin/mongod --port 27018 --dbpath=testdata0/rs0-1 --replSet=rs0
/opt/mongodb-osx-x86_64-enterprise-4.4.1/bin/mongod --port 27019 --dbpath=testdata0/rs0-2 --replSet=rs0
And for the driver:
node --experimental-repl-await
const m = require('mongodb');
const c = await m.MongoClient.connect('mongodb://127.0.0.1:27017', { useUnifiedTopology: true })
> [MongoServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017]
however if I run:
const m = require('mongodb'); const c = await m.MongoClient.connect('mongodb://127.0.0.1:27017')
or try to connect with the shell I get no errors.
- duplicates
-
NODE-2966 Unified topology: server selection fails when trying to connect to a remote replica set with a member whose 'host' attribute resolves to 'localhost'
- Closed
- is depended on by
-
MONGOSH-455 Can't connect to the replica server where replica set is not initiated yet
- Closed
-
MONGOSH-467 Update driver to 4.0
- Closed