title: Wait for queries with sequelize
body: <p>I'm currently using Node.js with Sequelize (MySQL) and have two models that have an association between them: <code>M.belongsTo(C)</code>. What I'm trying to do is to query all C and add all M that belongs to C to the returned JSON object. See code below that represents my latest attempt:</p>
  
  <pre><code>C.findAll({
      where: {
          parent_ids: ids
      }
  }).then(cs =&gt; {
      let fCs = [];
      for (let j = 0; j &lt; cs.length; j++) {
          let c = cs[j].get({ plain: true });
  
          M.findAll({
              where: {
                  CId: c._id
              }
          }).then(ms =&gt; {
              let cMs = [];
              for (let k = 0; k &lt; ms.length; k++) {
                  cMs.push(ms[k].get({ plain: true }));
              }
  
              c.ms = cMs;
          });
  
          fCs.push(c);
      }
  
      return res.json({
          success: true,
          cs: fCs
      });
  }).catch(error =&gt; {
      return res.json({
          success: false
      });
  });
  </code></pre>
  
  <p>The problem is that the inner query on <code>M</code> model is made as an async query and I get the response before any query is performed. I tried also using <code>Promise.all()</code>, but I couldn't make it work properly because I'm iterating in the outer <code>C</code> query.</p>
  
  <p>How can I make it work as expected?</p>