title: Spring Data MongoDB Date Between
body: <p>I use spring data mongodb.</p>
  
  <p>I want the records between two dates. The following MongoDB Query works:</p>
  
  <pre><code>db.posts.find({startDate: {$gte: start, $lt: end}});
  </code></pre>
  
  <p>My attempted Spring data query object code translation does not work:</p>
  
  <pre><code>Query query = new Query();
  query.addCriteria(Criteria.where("startDate").gte(startDate)
                              .and("startDate").lt(endDate));
  </code></pre>
  
  <p>What is the correct order of method calls to build the Mongo query I need?</p>