title: Spring-data mongodb geo query
body: <p>I am using spring-data to communicate with mongodb,I am looking for a way to perform geo query which will retrieve near by profiles by given geo point from DB, my requirements from the query  are:</p>
  
  <p>1) limit by distance <br/>
  2) limit by number of returned profiles <br/>
  3) additional search according time field in the profiles document<br/>
  4) the ability to include / exclude fields from the retrieved documents<br/></p>
  
  <p>At first I used <strong>mongoTemplate.geoNear</strong> method...</p>
  
  <pre><code>   Query criteria = new Query(Criteria.where("time").gte("some_date")); 
     criteria.fields().exclude("friends");
      NearQuery query = NearQuery.near(point).maxDistance(maxDistance)
              .num(limit).query(criteria);
      GeoResults&lt;Profile&gt; result = mongoTemplate
              .geoNear(query, Profile.class);&lt;br/&gt;
  </code></pre>
  
  <p>But then I realized that mongo does not support in including/excluding fields in geoNear queries.<br/>
  So I am thinking about <strong>Near</strong> query, it seems that the only way to perform that kind of "complex" query in spring-data is by using <strong>@Query</strong> annotation,is there a way to support requirements 2,3 above in that kind of query? any other way ?<br/>
  Thanks</p>