MongoError: getaddrinfo ENOTFOUND undefined undefined:27017
I think you are not providing the PORT NO.
required for mongoDB
.
Please give the port no.(27017)
along with localhost.
Try this:
var dbURI = "mongodb://127.0.0.1:27017/loc8r";
getaddrinfo ENOTFOUND
means client was not able to connect to the given address. Please try with the above address.
I hope this helps.
if you use docker with this problem, I solve that with this solution
I have the same problem, other solutions not work for me but i did that with this way
for mongo URI you must use your mongodb
service name
instead127.0.0.1
orlocalhost
for example in below docker-compose file my mongo service name is mongodb-myapp
and i change uri like this mongodb://mongodb-myapp:27017/myapp
and it works for me
services: boilerplate-api-app: build: . environment: - MONGO_URI=mongodb://mongodb-myapp:27017/myapp volumes: - .:/app ports: - "5000:5000" depends_on: - mongodb-myapp mongodb-myapp: image: mongo ports: - "27017:27017"