I am using node js, and for the backend i am using mongodb
For connecting to DB, if i use the below line, it is fetching data
var db = monk('localhost:27017/nodetest2');
But if i change that to below line, its not fetching the data
var db = monk('mongodb://username:[email protected]:27483/userdb');
I have created the collection with same name in both places
router.get('/userlist', function (req, res) {
var db = req.db;
var collection = db.get('userlist');
collection.find({}, {}, function (e, docs) {
res.json(docs);
});
});
e
variable in the query callback), log them so you get an idea what's going on (perhaps username/password mismatch). – Trenttrento