Hi I am trying to convert a mongodb collection to array and its not working giving me blank array any help would be appreciated playingCollection is mongodb collection.
var state = [];
playingCollection.find({},function(err, companies) {
companies.each(function(err,company){
if (company !== null) {
var obj = company.playername;
state.push(obj);
}
}
);
});
console.log(state);