title: NodeJS - how to send a variable to nested callbacks? (MongoDB find queries)
body: <p>I want to use result set of a find query in another result set. I couldn't explain this situation in english very well. I will try to use some code.</p>
  
  <pre><code>People.find( { name: 'John'}, function( error, allJohns ){
      for( var i in allJohns ){
          var currentJohn = allJohns[i];
          Animals.find( { name: allJohns[i].petName }, allJohnsPets ){
              var t = 1;
              for( var j in allJohnsPets ){
                  console.log( "PET NUMBER ", t, " = " currentJohn.name, currentJohn.surname, allJohnsPets[j].name );
                  t++;
              }
          }
      }
  });
  </code></pre>
  
  <p>Firstly, I get all people with <strong>find</strong> who are named John. Then I take those people as <strong>allJohns</strong>.</p>
  
  <p>Secondly, I get all pets of every Johns one by one in different <strong>find</strong> queries.</p>
  
  <p>In second callback, I get every pet one by one again. But when I want to display which John is their owners, I always got same John.</p>
  
  <p>So, the question is: how can I send every John separately to the second nested callback and they will be together as real owners and pets.</p>
  
  <p>I need to copy every John but I have no idea how can I do this.</p>