title: Iterating my mongo collections to send mutiple emails to multiple recipient
body: <p>I'm working with an aggregation to find matches so whenever two people select the same location, time and date it generates a new collection that is pushed ($out) to a matches document. I've generated 2 matches for testing and the structure of the document looks like this.</p>
  <pre><code>console.log(email)
  
  [
    { Data: [ [Object], [Object] ], Total: 2 },
    { Data: [ [Object], [Object] ], Total: 2 }
  ]
  </code></pre>
  <p>Now my intention is to send a email to each person in each match with the data of the other person, I used Nodemailer in the next way.</p>
  <pre><code>router.get('/email', async (req, res) =&gt; {
      const email = await Match.find()
  
      let transporter = nodemailer.createTransport({
          service: 'gmail',
          auth: {
              user:'xxxxx@gmail.com', 
              pass: 'xxxx'  
          }
      });
  
      let mail_option = {
          from: 'Test',
          to: email[0]._doc.Data[0].Email,
          subject: 'This is a test',
          html: ` ${email[0]._doc.Data[1].Name} ${email[0]._doc.Data[1].Surname}. &lt;br/&gt;&lt;br/&gt;
          ${email[0]._doc.Data[1].Email} `
      };
  
      let mail_option1 = {
          from: 'Test',
          to: email[0]._doc.Data[1].Email,
          subject: 'This is a test',
          html: `${email[0]._doc.Data[0].Nombre} ${email[0]._doc.Data[0].Apellido}.  &lt;br/&gt;&lt;br/&gt;
          ${email[0]._doc.Data[0].Email}`
      };
  
      transporter.sendMail(mail_option,  (err, info) =&gt;{
          if(err){
              console.log(err);
          }else{
              console.log('Works')
          }
      });
  
      transporter.sendMail(mail_option1,  (err, info) =&gt;{
          if(err){
              console.log(err);
          }else{
              console.log('Also works')
          }
      });
  
      res.json('Sent');
  
  });
  </code></pre>
  <p>I got it working sending emails nexr I'm trying to get it to send the emails to everyone in the matchs collections. I'm trying with the next example but it doesnt send the email, looks like it doesnt even enter the for as it doesnt give any console log and go straight to the res.json:</p>
  <pre><code>router.get(&quot;/email&quot;, async (req, res) =&gt; {
      const email = await Match.find();
      let data = email[0];
      for (data; data &lt; email.length; data++) {
          let transporter = nodemailer.createTransport({
              service: &quot;gmail&quot;,
              auth: {
                  user: &quot;xxxxx@gmail.com&quot;,
                  pass: &quot;xxxx&quot;,
              },
          });
  
          let mail_option = {
              from: &quot;Test&quot;,
              to: data._doc.Data[0].Email,
              subject: &quot;This is a test&quot;,
              html: ` ${data._doc.Data[1].Name} ${data._doc.Data[1].Surname}. &lt;br/&gt;&lt;br/&gt;
              ${data._doc.Data[1].Email} `,
          };
  
          transporter.sendMail(mail_option, (err, info) =&gt; {
              if (err) {
                  console.log(err);
              } else {
                  console.log(&quot;Works&quot;);
              }
          });
          res.json(&quot;Sent&quot;);
      }
  });
  </code></pre>
  <p>Any help would be deeply appreciate</p>