Hi I am trying to play around with async.parallel and here is my code for the call. When I go and checkout the console the results are undefined. This is pretty straight forward so i know I must be goofing up something simple.
async.parallel([
function(cb){
Challenges.find({}, function(err, docs){
cb(err, docs);
});
},
function(cb){
Challenges.find({}, function(err, docs){
cb(err, docs);
});
}
], function(results){
console.log("results "+util.inspect(results));
});
btw, I logged docs in each of the calls before the callback to make sure I am getting back data and am able to see the docs returned.
The result callback for async.parallel
has 2 parameters, not one. The first is err
.
async.parallel([
function(cb){
Challenges.find({}, function(err, docs){
cb(err, docs);
});
},
function(cb){
Challenges.find({}, function(err, docs){
cb(err, docs);
});
}
], function(err, results){
console.log("results "+util.inspect(results));
});