I have this function which gets some data from my database but i'm having a trouble calling the function and getting the proper response
function getEvents()
{
var x = [];
var l = dbCollection['e'].find({}).forEach(function(y) {
x.push(y);
});
return x;
});
and another function which calls this function but it always returns undefined. How can i make the function wait till mongoose has finished filling up the array?
Thanks for the help!
via JJ9
No comments:
Post a Comment