title: Why is the result of await/async undefined?
body: <p>I have a route like:</p>
  
  <pre><code>router.get("/my_resource", myController.getResult);
  </code></pre>
  
  <p>Then my controller is like:</p>
  
  <pre><code>getResult: async (req, res, next) =&gt; {
      try {
        const param = req.query.param;
        let response = {};
        if (param) {
          let [result1, result2] = await Promise.all([myModel.getResult1(param), myModel.getResult2(param)]);
          console.log(result1);
          console.log(result2);
        }
        res.send(response);
      } catch (e) { 
          next(e);
      }
    }
  </code></pre>
  
  <p>And my model (which is querying a mongodb) looks like:</p>
  
  <pre><code>getResult1: (param) =&gt; {
      new Promise((resolve, reject) =&gt; {
        MongoSchema1.findById(param, (error, result) =&gt; {
          if (error) return reject(error);
          resolve(result ? result : {});
        }).select("field1 field2");
      })
    }
  
  getResult2: (param) =&gt; {
    new Promise((resolve, reject) =&gt; {
      MongoSchema2.findById(param, (error, result) =&gt; {
        if (error) return reject(error);
        resolve(result ? result : {});
      }).select("field1 field2");
    })
  }
  </code></pre>
  
  <p>Here, when I try to <code>console.log()</code> in the model functions I can see that the result is not <code>undefined</code>. I get the correct result. However, I can see that the <code>console.log()</code> in the controller method gets executed before the <code>console.log()</code> in the model methods.</p>
  
  <p>In the code above, I'm making the async calls in parallel with <code>Promise.all()</code>. However, even if I try to run one at a time, I still get my result to be undefined in the controller method. What am I doing wrong? Do I need import any module before I can <code>await</code>? Thanks.</p>