[JAVA-2974] Add support for java 8 time API Created: 12/Sep/18  Updated: 14/Sep/18  Resolved: 14/Sep/18

Status: Closed
Project: Java Driver
Component/s: Codecs
Affects Version/s: 3.8.1
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: D T Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Spring Boot 2
Spring 5
MongoDB 4



 Description   

The java.util.Date API is outdated and has been replaced by far better mechanics.

It would be nice, if I could get java.time.Instants or LocalDateTimes from Bson's Documents in addition or instead of juDates.

I know I can just convert them, but it somewhat feels wrong.



 Comments   
Comment by Jeffrey Yemin [ 14/Sep/18 ]

Hi ST-DDT

I'm closing this issue, but please comment back if you have additional questions.

Comment by Jeffrey Yemin [ 12/Sep/18 ]

It takes a little work in the application, but you can already do this: http://mongodb.github.io/mongo-java-driver/3.8/bson/codecs/#bsontypeclassmap

Unfortunately we couldn't make this the default behavior without breaking backwards compatibility.

Instant is also supported in POJOs: http://mongodb.github.io/mongo-java-driver/3.8/bson/pojos/ 

Generated at Thu Feb 08 08:58:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.