title: ZonedDateTime with MongoDB
body: <p>Trying to use <code>ZonedDateTime</code> with <code>MongoDB</code>. I'm able to save <code>ZonedDateTime</code> in <code>MongoDB</code> but when i look at the record it has so much unnecessary stuffs in there:</p>
  
  <pre><code>&gt; "timestamp" : {
  &gt;             "dateTime" : ISODate("2016-12-13T13:45:53.991Z"),
  &gt;             "offset" : {
  &gt;                 "_id" : "-05:00",
  &gt;                 "totalSeconds" : -18000
  &gt;             },
  &gt;             "zone" : {
  &gt;                 "_class" : "java.time.ZoneRegion",
  &gt;                 "_id" : "America/New_York",
  &gt;                 "rules" : {
  &gt;                     "standardTransitions" : [ 
  &gt;                         NumberLong(-2717650800)
  &gt;                     ],
  &gt;                     "standardOffsets" : [ 
  &gt;                         {
  &gt;                             "_id" : "-04:56:02",
  &gt;                             "totalSeconds" : -17762
  &gt;                         }, 
  &gt;                         {
  &gt;                             "_id" : "-05:00",
  &gt;                             "totalSeconds" : -18000
  &gt;                         }
  &gt;                     ],
  &gt;                     "savingsInstantTransitions" : [ 
  &gt;                         NumberLong(-2717650800), 
  &gt;                         NumberLong(-1633280400), 
  &gt;                         NumberLong(-1615140000), 
  &gt;                         NumberLong(-1601830800), 
  &gt;                         NumberLong(-1583690400), 
  &gt;                         NumberLong(-1570381200),
  &gt; and so on....
  </code></pre>
  
  <p>Also when i try to retrieve this same date, it gives me following:</p>
  
  <pre><code>&gt; org.springframework.data.mapping.model.MappingException: No property
  &gt; null found on entity class java.time.ZonedDateTime to bind constructor
  &gt; parameter to!
  </code></pre>
  
  <p>I didn't have this problem when working with <code>LocalDateTime</code>. 
  First question is can we change some settings somewhere that will only persist <code>ISODate</code> with <code>ZonedDateTime</code>?
  Second question, is there something like <code>Jsr310JpaConverters</code> for <code>mongodb</code>?</p>
  
  <p><strong>UPDATE:</strong>
  Referencing the following questionaire I created custom converters and registered them,however, the issue still persists.
  <a href="https://stackoverflow.com/questions/22972679/spring-data-mongodb-with-java-8-localdate-mappingexception">Spring Data MongoDB with Java 8 LocalDate MappingException</a></p>
  
  <pre><code>public class ZonedDateTimeToLocalDateTimeConverter implements Converter&lt;ZonedDateTime, LocalDateTime&gt; {
      @Override
      public LocalDateTime convert(ZonedDateTime source) {
          return source == null ? null : LocalDateTime.ofInstant(source.toInstant(), ZoneId
                  .systemDefault());
      }
  }
  </code></pre>
  
  <p>And </p>
  
  <pre><code>public class LocalDateTimeToZonedDateTimeConverter implements Converter&lt;LocalDateTime,
          ZonedDateTime&gt; {
      @Override
      public ZonedDateTime convert(LocalDateTime source) {
          return source == null ? null : ZonedDateTime.of(source, ZoneId.systemDefault());
      }
  }
  </code></pre>
  
  <p>Registered them as follows:</p>
  
  <pre><code>@Bean
  public CustomConversions customConversions(){
          List&lt;Converter&lt;?,?&gt;&gt; converters = new ArrayList&lt;Converter&lt;?,?&gt;&gt;();
          converters.add(new ZonedDateTimeToLocalDateTimeConverter());
          converters.add(new LocalDateTimeToZonedDateTimeConverter());
          return new CustomConversions(converters);
      }
  
  @Bean
  public MongoTemplate getMongoTemplate() throws UnknownHostException {
          MappingMongoConverter converter = new MappingMongoConverter(
                  new DefaultDbRefResolver(getMongoDbFactory()), new MongoMappingContext());
          converter.setCustomConversions(customConversions());
          converter.afterPropertiesSet();
          return new MongoTemplate(getMongoDbFactory(), converter);
      }
  </code></pre>