Watch keynotes and sessions from, our virtual developer conference.

MongoError replicaset / no primary server

I’m using a MongoDB Atlas sandbox database to develop a Meteor application. I have for many weeks successfully connected via both a localhost version of my app and also a public version hosted on Meteor Galaxy.

This morning, I keep getting this error on localhost:
MongoError: no primary found in replicaset or invalid replica set name

And this error on the Galaxy version:
no primary server available

(There’s more to the error messages, can share more if that matters.)

I’ve searched a lot online, but can’t figure it out. I can connect to the DB via the Atlas website, from my command line using mongodump, from my computer using MongoDB Compass. I’ve checked whitelisting, and everything else I can think of. I can see a restart in the metrics graphs overnight. Seems significant, but one of several in the last 2 months where I’ve seen no errors connecting till now.

Is there are an error log to read? Does anybody have further ideas on troubleshooting?! Thanks in advance…

More info: There was a period of several hours overnight where these 2 replica sets switched back and forth between primary and secondary many times. See attached screenshot.

It works now. How I solved it: I did nothin’ but wait!