var count = 0;
list.forEach(function(entry){
var coll = db.collection(entry);
coll.count(function(err,result){
count = count + result;
})
})
function(count){
//do something with count
}
I'm using the mongoDB native driver on node.js and the problem is that the function that is supposed to use count after it has done counted all the entries in each collection fires of to early, which is obvious as it asynch. I've searched after a solution for quite some time but haven't found anything yet.