vendredi 27 juin 2014

NodeJS Async: Callback already called?


Vote count:

0




I'm using Async module in Node.JS to keep track of my asynchronous calls. However, I'm getting an error - "Callback already called." Can someone help me out here?



async.each(data['results'], function(result, done) {
if (result['twitter_id'] !== null) { //Isolate twitter handle
var param = { "user.screen_name": result['twitter_id']}
db.test4.find( param, function(err, users) {
if( err ) {
return done(err);
} else if (!users) {
res.send("No user found");
} else {
users.forEach( function(Result) {
twitter_ids.push(Result);
//console.log(Result);
done();
});
}
});
}
}, function(err) {
if (err) {
throw err
}
res.send(twitter_ids);
});


asked 24 secs ago






Aucun commentaire:

Enregistrer un commentaire