Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-2901

v3.6.3/v4.0.0 fails to connect to uninitialized replset with useUnifiedTopology

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            anna.herlihy@mongodb.com Anna Herlihy (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: