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.


You just missed specifying the port number as shown:

  var dbURI = "mongodb://localhost:27017/thenDBname"

Make sure to change localhost while hosting on production server.