title: Node.js - Async Whilst loop not iterating
body: <p>Based off suggestions from a previous question <a href="https://stackoverflow.com/questions/18023787/illegal-break-statement-node-js?noredirect=1#comment26362282_18023787">Illegal break statement (Node.js)</a> , I implemented <code>async.whilst()</code>, but it is not iterating more than once.</p>
  
  <p>I am trying to find a unique ID, by incrementing a number at the end of an ID, and querying Mongo to see if that ID exists. If it doesn't exist, the unique ID is found. It is only looping once, instead of until a unique is found. What is wrong?</p>
  
  <p>The code:</p>
  
  <pre><code> var uniqueNumber = 1;
   var newUnique;
  
   async.whilst(
      function () { 
  
         var uniqueNum_string = uniqueNumber.toString(); 
         newUnique = data.id + uniqueNum_string;
  
         db.collection('landmarks').findOne({'id':newUnique}, function(err, data){
  
             if (data){
                console.log('entry found!');
                return;
             }
  
             else {
                console.log('entry not found!');
  
             }
          });
  
    },
    function (callback) {
  
       uniqueNumber++;
  
     },
     function (err) {
  
        saveLandmark(newUnique);
     }
  );
  </code></pre>