title: JavaScript async/await not working as expected
body: <p>I am using <code>async</code>/<code>await</code> but it is not working as expected. The data is being updated before the promise is resolved.</p>
  <pre><code>export const update = async (req, res) =&gt; {
  let lead = Lead.findbyid(id)
  let updates = req.body.updates
  if (updates.clientDetails.alternateContacts &amp;&amp; updates.clientDetails.alternateContacts.length &gt; 0) {
        updates.clientDetails.alternateContacts.forEach(async ele =&gt; {
          if (ele.addedOn) console.log('date exists')
          else ele.addedOn = new Date()
  
          if (ele.email) {
            console.log('11111111111111111111');
            let clientId = await createAutoAccount({ email: ele.email, name:ele.name, contactNumber: ele.phoneNumber })
            console.log('22222222222222222222222', clientId);
            ele.userId = clientId
          }
        })
        lead.clientDetails.alternateContacts = updates.clientDetails.alternateContacts
      }
  
  await lead.save();
  }
  </code></pre>
  <pre><code>export const createAutoAccount = async (data) =&gt; {
  let user = await User.findOne({ email: data.email });
      if (user) {
        console.log('user found =======================', user._id);
      } else {
        console.log('new user created ---------------');
        const tempObj = {
          email: data.email,
          password: data.password ? data.password : 'user123',
          full_name: data.name ? data.name : null,
          contact_number: data.contactNumber &amp;&amp; !isNaN(data.contactNumber) ? data.contactNumber : null,
        };
        user = await User.create(tempObj);
      }
  
      return user._id;
  }
  </code></pre>
  <p>The order of output is:</p>
  <pre class="lang-none prettyprint-override"><code>11111111111111111111 
  
  update lead
  
  user found ======================= 617155c8827ab456041342ad
  
  22222222222222222222222 617155c8827ab456041342ad
  </code></pre>
  <p>what is want is:</p>
  <pre class="lang-none prettyprint-override"><code>11111111111111111111 
  
  user found ======================= 617155c8827ab456041342ad
  
  22222222222222222222222 617155c8827ab456041342ad
  
  update lead
  </code></pre>
  <p>Please let me know what needs to be modified to make this work as per expectations.</p>