I need to do a sequence of database calls but I don't know exactly how many time. Something like this
DBcall(params, function(err, result) {
// doing something with result
if (//condition)
return;
// modify params
DBcall(params, function(err, result) {
........
I would like to do this in a while loop, like
while(//condition) {
DBcall(params, function(err, result) {
........
}
//modify params
}
but DBcall return instantly, so it is looping forever, anyway to solve this?