mongoose connection throwing MongooseServerSelectionError mongoose connection throwing MongooseServerSelectionError mongoose mongoose

mongoose connection throwing MongooseServerSelectionError


It is something related to your ip address probably.Go to Network Access toolbar option click on EDIT button and then on ADD CURRENT IP ADDRESS and confirm.This worked for me.


You are probably behind a corporate firewall.

If you are not sure, you can check to see if you can reach the MongoDB port(27017 from your stacktrace) using a third party site, found in the MongoDB documentation, where there are instructions specifically for the issue you've run into.


Using Mongo 3.6 and Mongoose 5.9.1 connecting to a replicaSet not on Atlas, setting useUnifiedTopology to true caused my issues. Removing this from my options made it work.

{ useUnifiedTopology: false } or don't set it at all and let it default to false

https://github.com/Automattic/mongoose/issues/8180