title: How to get Count of aggregation query in spring mongo template
body: <p>I'm using spring mongo template to run an agreegation query on mongodb. I'm wondering is there any way to find out the count of aggregation result in spring mongo template?</p>
  
  <p>Here is my Aggregation sample :</p>
  
  <pre><code>Aggregation agg = newAggregation(Class1.class,
              match(criteria),
              group("prop1", "prop2")
              .avg("x").as("averageX")
          );
  </code></pre>
  
  <p>I just need to know how to get count of this aggregation result in spring mongo template.</p>