Answer the question
In order to leave comments, you need to log in
How to properly connect MongoDB Atlas on hosting?
I can't connect to MongoDB Atlas specifically on the hosting, everything works fine on the local one. Already tried everything I could find on the Internet.
I connect like this:
mongoose
.connect(
'mongodb://<username>:<password>@cluster0-shard-00-00-eveil.mongodb.net:27017,cluster0-shard-00-01-eveil.mongodb.net:27017,cluster0-shard-00-02-eveil.mongodb.net:27017/test?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=true&w=majority',
{ useNewUrlParser: true }
)
.then(() => console.log('MongoDB Connected...'))
.catch(err => console.log(err));
mongodb+srv://<username>:<password>@cluster0-eveil.mongodb.net/test?retryWrites=true&w=majority
Error: querySrv EREFUSED _mongodb._tcp.cluster0-eveil.mongodb.net
at QueryReqWrap.onresolve [as oncomplete] (dns.js:196:19)
MongoNetworkError: failed to connect to server [cluster0-shard-00-02-eveil.mongodb.net:27017] on first connect [MongoNetworkError: getaddrinfo EAI_AGAIN cluster0-shard-00-02-eveil.mongodb.net:27017]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question