title: MongoDB Query group and distinct together
body: <p>Consider the following set of documents: </p>
  
  <pre><code>[
    {
      "name" : "nameA",
      "class" : "classA",
      "age" : 24,
      "marks" : 45
    },
    {
      "name" : "nameB",
      "class" : "classB",
      "age" : 22,
      "marks" : 65
    },
    {
      "name" : "nameC",
      "class" : "classA",
      "age" : 14,
      "marks" : 55
    }
  ]
  </code></pre>
  
  <p>I need to fetch the min and max values for age and marks as well as the distinct values for name and class.</p>
  
  <p>I know that I can use aggregate and group to get the max and min values of age and marks with one query, and I can get distinct values of name and class using distinct query.</p>
  
  <p>But I don't want to do separate queries to fetch that information. Is there a way in which I can get the result with one query? Let's say if I can merge the aggregate and distinct somehow.</p>