I am trying to get JSON from Mongodb using Express.js, and it returns "Undefined" in my console. Could you advise?
app.js:
var db = monk('localhost:27017/nodetest1', {
username : 'USERNAME',
password : 'PASSWORD'
});
index.js:
router.get('/url', function(req,res){
var db = req.db;
var collection = db.get('test1');
collection.find({},{},function(e,docs){
console.log(docs) // Returns "Undefined"
res.send(docs);
});
});