mongo-express: Can't connect to replica set on MongoAtlas

I get the following error when I try and start mongo-express.

/home/jamrizzi/GroupThreads/mongui/node_modules/mongodb/lib/replset.js:360
          process.nextTick(function() { throw err; })
                                        ^
MongoError: no valid replicaset members found
    at Timeout.<anonymous> (/home/jamrizzi/GroupThreads/mongui/node_modules/mongodb-core/lib/topologies/replset.js:645:33)
    at tryOnTimeout (timers.js:232:11)
    at Timer.listOnTimeout (timers.js:202:5)

I have it configured as a replica set, and I have verified that all the information I entered is correct by trying it with the mongodb CLI. Below is the way I have it configured.

  mongo = {
    db:       'admin',
    host:     [
        'rest-api-data-shard-00-00-xemv3.mongodb.net',
        'rest-api-data-shard-00-01-xemv3.mongodb.net',
        'rest-api-data-shard-00-02-xemv3.mongodb.net'
    ],
    password: 'myspecialpassword',
    port:     27017,
    ssl:      true,
    url:      'mongodb://rest-api-data-shard-00-00-xemv3.mongodb.net:27017,rest-api-data-shard-00-01-xemv3.mongodb.net:27017,rest-api-data-shard-00-02-xemv3.mongodb.net:27017/admin?replicaSet=rest-api-data-shard-0',
    username: 'myspecialusername'
  };

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Reactions: 2
  • Comments: 63 (27 by maintainers)

Most upvoted comments

@jamrizzi I would say team is a big word. Current maintainers are doing it completely for free, in their free time and are not the one who created the original code base. We’d love to get more people involved in this. If someone wants to do a rewrite of the connection module it’d be really nice.

I am also using atlas and I get a “no primary found in replicaset” error. I guess because there is no place to put the replicaSet parameter? Is there some way I can get this working?

Actually you are right. Hmmm we’re using the higher level driver (I don’t know why I had in mind the other driver). I wonder why we’re not using the normal “url” connection method, from this driver.