title: Mongotemplate group exception
body: <p>I get NullPointerException when running mongo template group operation.</p>
  
  <p>The code looks like this:</p>
  
  <pre><code>GroupByResults&lt;Recommendation&gt; recommendations 
      = mongoTemplate.group("recommendation",
            GroupBy.key("doctor"), 
            Recommendation.class
  );
  </code></pre>
  
  <p>The POJO is:</p>
  
  <pre><code>package med.rec.model;
  
  @Document
  public class Recommendation extends BaseModel {
      public Recommendation(){
  
      }
  
  
      @Indexed
      @DBRef  
      private Doctor doctor;
      @Indexed
      private String specialty;
      private String x;  
      private int y;
      private int z;
      private int w;
      private String f;
      /*All getter and setters */ 
  }
  </code></pre>
  
  <p>The stack trace seems to be not informative at all but here it is:</p>
  
  <pre><code>ava.lang.NullPointerException
  org.springframework.data.mongodb.core.MongoTemplate.group(MongoTemplate.java:1225)
  org.springframework.data.mongodb.core.MongoTemplate.group(MongoTemplate.java:1199)
  med.rec.controller.api.v1.RecommendationController.all(RecommendationController.java:43)
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  java.lang.reflect.Method.invoke(Method.java:601)
  org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)
  org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
  org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749)
  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:690)
  org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
  org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945)
  org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876)
  org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
  </code></pre>
  
  <p>Please advise.</p>
  
  <p>Thank you,
  Roy</p>