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:password@XXX.mongolab.com: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);
});
});