title: NodeJS and asynchronous process with models
body: <p>I work with the last beta version of Sails / Waterline for NodeJS, the association system isn't ready yet so i'm trying to find a way to populate datas from other models with a small trick.</p>
  
  <p>For example, I got a "User" model which has many "Server", let's forget about waterline populate() which is for now quite bugued and find out how to do it manually in pseudo-code :</p>
  
  <pre><code>FIND USER THEN { // asynchronous
  
    LOOP XXX
  
      FIND (EACH) SERVER FROM ID { // asynchronous
  
       DO THINGS HERE
  
      }
  
    END LOOP
  
    THEN OUTPUT SOMETHING
  
  }
  </code></pre>
  
  <p>I think you already understood the big problem i got. The "THEN OUTPUT SOMETHING" will output something before the loop is ended because it's asynchronous requests. I tried to check on async (with callbacks, but there's nowhere to put it here) or these kind of tools but it seems there is nothing to handle this typical case that will appear everywhere in my project ...</p>
  
  <p>Any idea ? That's really a big problem for every project I could make in NodeJS and i'm sure i'm not alone in this case ...</p>
  
  <p>Thanks ;)</p>