title: Mongodb count of distinct, sum function with group by multiple columns
body: <p>I have transaction table which is populated by holidays taken by the employees. I would need help on following sql scenario in mongodb.</p>
  
  <p>select employee,month,year,count(distinct (holiday_type),sum(hours) from 
  transactions group by employee,month,year</p>
  
  <p>I have started mongodb couple of weeks back. I have got the partial answer through is stack overflow post <a href="https://stackoverflow.com/questions/23650136/mongodb-count-distinct-with-multiple-group-fields">Mongodb count distinct with multiple group fields</a>  and now am looking to add sum function.</p>
  
  <p>Any guidance will be really helpful, here is a sample of the data shown in table form:</p>
  
  <pre><code>Employee    date      holiday_type  hours
  1           1/1/2014  1             8 
  1           1/5/2014  2             7 
  1           2/15/2014 1             8 
  1           3/15/2014 3             16 
  11          1/1/2014  1             8 
  11          1/5/2014  1             6 
  11          2/15/2014 3             8 
  11          3/15/2014 3             8
  </code></pre>