title: How to work with Async/Await in expressjs router?
body: <p>I've been battling with an issue concerning Async/Await, I'm relatively new to Nodejs. I have a repository where I connect directly to my mongodb collection to retrieve some data it but when I connect my controller to this repository, I get a nulled response.
  Please checkout my code below:-</p>
  
  <p><strong>SyncRepository.js</strong></p>
  
  <pre><code>const mongoose = require('mongoose');
  
  exports.ItemRepo = async (limit) =&gt; {
    try {
       await mongoose.connection.db.collection('items_1087342')
          .find({}, {timeout: false}).limit(limit).toArray((err, results) =&gt; {
              // results.forEach(e =&gt; {
              //     console.log(e.item_id);
              // }); //This works well
              return results;
          });
   } catch (e) {
      throw Error('Error Loading Data:- ' + e.message);
   }
  };
  </code></pre>
  
  <p><strong>SyncController.js</strong></p>
  
  <pre><code>const syncRepo = require('../../../Repositories/Sync/SyncRepository');
  
  exports.getItem = async (req, res) =&gt; {
    try {
       await syncRepo.ItemRepo(7)
          .then(element =&gt; {
              console.log(element);
             return res.json(element); //This return null
          });
      // return await res.json(await syncRepo.ItemRepo(7));
   } catch (e) {
      return res.status(400).json({ status: 400, message: e.message });
   }
  };
  </code></pre>