title: trying to await a loop
body: <p>I am trying to get data from database I have an array in which collection of id are present and i try to get data from a database for each id and then send to a client if try something like this:-</p>
  
  <pre><code>router.get('/getcart1', async (req, res) =&gt; {
    const email = req.body.email;`enter code here`
    const data = await cart1.find({ email: email });
    const id = data[0].id;
  
    let details = await id.map(async (e) =&gt; {
      console.log('start');
      console.log(e);
      let data = await books.find({ _id: e });
      console.log('end');
      return data;
    });
    res.json({ data: details });
  });
  </code></pre>
  
  <p>the execution is start e start e end end 
  ans when we send data details it show empty object i want all details.Inside a loop i have data but outside it show empty object</p>