What uri should i use I have added in network so that its accessible publicly

I am on windows cmd

the uri I am using is - mongodb://myusername:mypassword@cluster0.ikhum.mongodb.net:27017/test?authSource=admin

I am getting this error

[nodemon] starting `node ./src/index.js`
server started on port 3000 (development)
MongoDB connection error: MongoError: failed to connect to server [cluster0.ikhum.mongodb.net:27017] on first connect [Error: getaddrinfo ENOTFOUND cluster0.ikhum.mongodb.net
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26) {
  name: 'MongoError',
  message: 'getaddrinfo ENOTFOUND cluster0.ikhum.mongodb.net'

What should I do

Can you connect by shell?

From your Atlas account you can get the connect string for your app node.js
Something like below:


Replace mongodb:// in your URI with mongodb+srv://.


This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.