title: MongoTemplate : group by on multiple fields with condition clause
body: <p>Earlier I had below mentioned aggregation pipeline.</p>
  
  <pre><code>db.EXCEPTIONS.aggregate(
  [{ $match : {
          $and : [
              {workflow_stage_current_assignee : {$ne:null}},
              {CreatedDate:{$gt:ISODate("2017-07-12")}}, 
              {CreatedDate:{$lt:ISODate("2018-07-12")}} 
          ]}
   },
   {
       $group : {_id: {user : "$workflow_stage_current_assignee", cm:"$control_monitor"},
                 exceptions:{$sum:1} }   
   },
   { $project : {"user":1,"cm":1,"exceptions":1}},
   { $sort : {"exceptions":1}}
  
  ]);
  </code></pre>
  
  <p>And corresponding conversion in Mongo template is as below. </p>
  
  <pre><code>Calendar fromDate = Calendar.getInstance();
  fromDate.set(2016, 7, 12, 0, 0, 0);
  
  Calendar toDate = Calendar.getInstance();
  toDate.set(2018, 7, 12, 23, 59, 59);
  
  MatchOperation match = Aggregation.match(new Criteria("workflow_stage_current_assignee").ne(null)
          .andOperator(new Criteria("CreatedDate").gte(new Date(fromDate.getTimeInMillis()))
          .andOperator(new Criteria("CreatedDate").lte(new Date(toDate.getTimeInMillis())))));
  
  GroupOperation group = Aggregation.group("workflow_stage_current_assignee","control_monitor").count().as("exceptions");
  
  ProjectionOperation project = Aggregation.project("workflow_stage_current_assignee","control_monitor","exceptions");
  
  SortOperation sort=Aggregation.sort(Sort.Direction.DESC,"exceptions");
  
  Aggregation aggregation  = Aggregation.newAggregation(match,group,project,sort);
  
  AggregationResults&lt;ExceptionCount&gt; output  = mongoTemplate.aggregate(aggregation, "EXCEPTIONS", ExceptionCount.class);
  </code></pre>
  
  <p>This worked fine. Then I modified original query as below and added additional grouping option as overdue.</p>
  
  <pre><code>$group : {_id: {user : "$workflow_stage_current_assignee", cm:"$control_monitor"},
                 exceptions:{$sum:1},
                 },
                 overdue: {$sum : {$cond :[ 
                                      {$gt:["$CreatedDate",ISODate("2017-07-12")]},1,0
                                  ]}
                 }
  </code></pre>
  
  <p>But I am not aware how to achieve this additional group clause in Mongo Template queries. I searched on internet but most of the results use DBObject from older API. Can any one help me in this with Mongo Template?    </p>