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