I'm working on a nodejs + express + mongodb project. I'm using monk for accessing my mongo DB.
var myvar;
var myCollection = db.get('myCollection');
myCollection.find({},function(e,docs){
myvar = docs;
})
console.log(myvar)
This outputs undefined. If I try to output the object inside the function, there is no problem. How can I save the object globally?