I have a working code that looks like this:
var test = {
'tst' : function () {
var collection = db.collection('subscriptions');
collection.find().toArray(function(err, docs) {
console.log(docs);
db.close();
});
}
}
Is there a way to pass the value of "docs" to a variable? I tried accessing the value of docs using the code below:
console.log(test.tst().collection().docs);
but not working, please help. Thank you