title: Group by subdocument field using aggregation framework
body: <p>The structure is the following:</p>
  
  <pre><code>{
      "_id" : "79f00e2f-5ff6-42e9-a341-3d50410168de",
      "bookings" : [
          {
              "name" : "name1",
              "email" : "george_bush@gov.us",
              "startDate" : ISODate("2013-12-31T22:00:00Z"),
              "endDate" : ISODate("2014-01-09T22:00:00Z")
          },
          {
              "name" : "name2",
              "email" : "george_bush@gov.us",
              "startDate" : ISODate("2014-01-19T22:00:00Z"),
              "endDate" : ISODate("2014-01-24T22:00:00Z")
          }
      ],
      "name" : "Hotel0",
      "price" : 0,
      "rating" : 2 
  }
  </code></pre>
  
  <p>Now, I want to generate a report telling me how many bookings were made, grouped by booking month (assume that only booking start date matters) and also grouped by hotels rating.</p>
  
  <p>I expect the answer to be like that:</p>
  
  <pre><code>{
      {
          rating: 0,
          counts: {
              month1: 10,
              month2: 20,
              ...
              month12: 7
          }
      }
      {
          rating: 1,
          counts: {
              month1: 5,
              month2: 8,
              ...
              month12: 9
          }
      }
      ...
      {
          rating: 6,
          counts: {
              month1: 22,
              month2: 23,
              ...
              month12: 24
          }
      }
  }
  </code></pre>
  
  <p>I tried this with aggregation framework but I'm a little bit stuck.</p>