title: Node async await function execution not in order
body: <p>I'm confused. I'm new to async so I know I'm missing something fundamental but I'm scratching my head. From the examples I've seen, I thought I had this right but...</p>
  <p>The below code works fine when mocked. However, when I fetch the real dashboard object from mongo I can see execution is not in order. Therefore the code that relies on there being a dashboard object fails due to it being 'undefined'.</p>
  <p><strong>Relevant code</strong></p>
  <pre><code>router.get('/:id?', (req, res) =&gt; {
    getDashboardData(req)
  })
  
  async function getDashboardData(req) {  
    const dashboardId = await getDashboardId(req)
    const dashboard = await loadDashboard(dashboardId)
    const results = await showResults(dashboardId, dashboard)
  }
  
  async function getDashboardId(req) {
    dashboardId = req.params.id.trim()
    // Some other things happen here but ultimately we return a UUID 
    return(dashboardId)
  }
  
  async function loadDashboardFromId (dashboardId) {  
    Dashboard.findOne({dashboardId: dashboardId}).then((dashboard) =&gt; {
      if (dashboard == null || dashboard.dashboardId == null) {
        throw new Error('No dashboard matched in loadDashboardFromId for dashbardId: ' + dashboardId)
      } else {
        console.log('dashboard within loadDashboardFromId: ' + dashboard)
        return dashboard
      }      
    })
  }
  
  async function showResults(dashboardId, dashboard) {
    console.log(&quot;dashboardId: &quot; + dashboardId)
    console.log(&quot;dashboard within showResults: &quot; + dashboard)
  }
  </code></pre>
  <p>Console output below. You can see showResults() executes before loadDashboard() returns:</p>
  <pre><code>connected to mongo server.
  open connection to mongo server.
  dashboardId: dbc7e954-c6a7-490f-8d9b-4dd11f11d262
  dashboard within showResults: undefined
  dashboard within loadDashboardFromId: {
    _id: new ObjectId(&quot;6208f552a442468c65987e62&quot;),
    dashboardId: 'dbc7e954-c6a7-490f-8d9b-4dd11f11d262',
    createdDate: 2022-02-13T00:00:00.000Z,
    surveyId: 'b55a58d6-63f1-473e-9a3c-34f5d63af499',
    participantId: '9b274cfe-68ea-4206-9f3c-f2ee309ec4de',
    personalityTotal: new Decimal128(&quot;69&quot;),
   // etc }```
  </code></pre>