In my node application, i am using following code to run some query. I want to call callback function after (arraySize > 100) and exit. Currently i can only exit after all processing is complete.
var matchedUsers = [];
client.eachRow(query, [], { prepare : true }, function (n, row) {
if(someCondition){
matchedUsers.push(row.x);
}
if(matchedUsers.length>100){
//exit here
}
}, function (err) {
callback(matchedUsers)
} );
Aucun commentaire:
Enregistrer un commentaire