title: MongoDB aggregate count based on multiple query fields - (Multiple field count)
body: <p>My collection will look this,</p>
  
  <pre><code>{
      "_id" : ObjectId("55c8bd1d85b83e06dc54c0eb"),
      "name" : "xxx",
      "salary" : 10000,
      "type" : "type1"
  }
  {
      "_id" : ObjectId("55c8bd1d85b83e06dc54c0eb"),
      "name" : "aaa",
      "salary" : 10000,
      "type" : "type2"
  }
  {
      "_id" : ObjectId("55c8bd1d85b83e06dc54c0eb"),
      "name" : "ccc",
      "salary" : 10000,
      "type" : "type2"
  }
  </code></pre>
  
  <p>My query params will be coming as,</p>
  
  <blockquote>
    <p>{salary=10000, type=type2}</p>
  </blockquote>
  
  <p>so based on the query I need to fetch the count of above query params</p>
  
  <p><strong>The result should be something like this</strong>,</p>
  
  <blockquote>
    <p>{ category: 'type1', count: 500 } { category: 'type2', count: 200 } { category: 'name', count: 100 }</p>
  </blockquote>
  
  <p>Now I am getting count by hitting three different queries and constructing the result (or) server side iteration I can get the result.</p>
  
  <p>Can anyone suggest or provide me good way to get above result</p>