title: Getting Percentage of 3 Entities with total number of entities in Mongoose? Taking total count from mongoose
body: <p>I am working on a Node Express and Mongoose backend and i want to calculate the percentage of Pending, In-Progress and Complete requests to Total number of requests. </p>
  
  <p>I have took count from db of total no of requests and divided it with 100 but i need to get count of Pending, In-Progress and Complete count as well.</p>
  
  <pre><code>totalcount: (req, res) =&gt; {
          UserRequest.countDocuments()
  
          .then(result =&gt; {
              if (!result) res.json({ success: false, result: "No result found"});
  
              res.json({success: true, result:  result / 100 });
          })
          .catch(err =&gt; res.json({success: false, result: err}))
      }
  </code></pre>
  
  <p>It should return:</p>
  
  <blockquote>
    <p>Pending: 30%<br>
    In-Progress: 40%<br>
    Complete: 30% as output  </p>
  </blockquote>