How to fix 'Error: querySrv EREFUSED' when connecting to MongoDB Atlas?
I had this same error when I was connecting with Node
version 3.0 or later
and I resolved it by downgrading to 2.2.12 or later
version:
If you're encountering this error try to use the older connection string for Node.js 2.2.12 or later:
mongodb://<username>:<password>@main-shard-00-00-03xkr.mongodb.net:27017,main-shard-00-01-03xkr.mongodb.net:27017,main-shard-00-02-03xkr.mongodb.net:27017/main?ssl=true&replicaSet=Main-shard-0&authSource=admin&retryWrites=true
According to MongoDB, SRV is possibly not working due to Mongoose.