title: Comparing Two Constructions of the Same Async/Await Function
body: <p>I am trying to determine if these two ways of setting up this section of a function are functionally equivalent - in terms of when the <code>forEach()</code> block runs. </p>
  
  <p>NOTE: "Customer" here represents a Mongoose model.</p>
  
  <p>Here's the first construction of the function:</p>
  
  <pre><code>  async processRecords() {
     // other code
      while (recordsProcessed &lt; recordsTotalCount) {
        await Customer.find({
            updatedAt: {
              $gte: this.lastUpdateTime
            }
          })
          .limit(recordsPerRun)
          .skip(recordsProcessed)
          .exec((err, docs) =&gt; {
            docs.forEach((doc) =&gt; {
              this.next(doc);
            });
          });
       }
    }
  </code></pre>
  
  <p>And here's the second one:</p>
  
  <pre><code>  async processRecords() {
      // other code
      while (recordsProcessed &lt; recordsTotalCount) {
        request.parameters.skip = recordsProcessed;
        request.parameters.limit = recordsPerRun;
  
        let docs = await request.find(Customer, {
          updatedAt: {
            $gte: this.lastUpdateTime
          }
        });
        docs.forEach(doc =&gt; {
          this.next(doc);
        });
      }
    }
  </code></pre>
  
  <p>Specifically, I'm curious if the <code>forEach()</code> block will run differently, or the same. For these two constructions of the function, will all the records be "found" first, and then the <code>forEach()</code> will run on each record?</p>