title: Query by date in mongodb using java
body: <p>I was going to get distinct values form collection. 
  I stored time as follows:</p>
  
  <pre><code>"time" : ISODate("2017-01-26T09:46:26.523Z")
  </code></pre>
  
  <p><code>new ISO8601DateFormat()</code> is not working, that gives me below error</p>
  
  <blockquote>
    <p>org.bson.codecs.configuration.CodecConfigurationException: Can't find
    a codec for class
    com.fasterxml.jackson.databind.util.ISO8601DateFormat.</p>
  </blockquote>
  
  <p>My code is looks like below.</p>
  
  <pre><code>Query query = new Query();
  query.addCriteria(Criteria.where("user_id").is(id).and("time").gt(new ISO8601DateFormat()));
  mongoTemplate.getCollection("user_log").distinct("timezone", query.getQueryObject())
  </code></pre>
  
  <p>My mongodb terminal command is follows and it works perfectly.</p>
  
  <pre><code>db.user_log.find({ "user_id" : "1" , "time" : { "$gt" : new ISODate("2017-01-25T00:16:15.184Z")}})
  </code></pre>
  
  <p>What is correct way to approach when I access from java?</p>