title: MongoDB: How to count the number of documents for every category?
body: <p>I am currently trying to find the number of ratings per a hotel. It is in this 
  <a href="https://i.stack.imgur.com/YkgJP.png" rel="nofollow noreferrer">format</a>.</p>
  
  <p>I tried running the following:</p>
  
  <blockquote>
    <p>db.reviews.aggregate([{$group:{_id:{hotel:'$HotelInfo.Name'}, totalReviews: {$sum:1}}}])</p>
  </blockquote>
  
  <p>The result of course just gave me the name of each hotel followed by a 1. How do I correctly display what I want to show?</p>