Can't connect to a MongoDB using Node.js
connection, mongodb, node.js
Solution
it worked for me when i changed 'localhost' to 127.0.0.1
Problem
Can't connect to a MongoDB using Node.js. This is my code (mdb.js): ``` var MongoClient = require('mongodb').MongoClient, format = require('util').format; MongoClient.connect('mongodb://localhost:3000', function(err,db){ if(err){ throw err; } else { console.log("Connected"); } db.close(); }); ``` node mdb.js prints MongoError: enter image description here