Insertion of an entity with an Instant
value, using ReactiveMongoRepository:
MyEntity inserted = myReactiveMongoRepository.insert(entity).block();
System.out.println("inserted.getSent() = " + inserted.getSent());
// inserted.getSent() = 2022-09-17T00:20:58.399300383Z
Reloading the entity after insertion:
MyEntity loaded = myReactiveMongoRepository.findById(inserted.getId()).block();
System.out.println("loaded.getSent() = " + loaded.getSent());
// loaded.getSent() = 2022-09-17T00:20:58.399Z
The instant value has been trimmed to milliseconds precision in Mongo, which is fine. Still, the insert above returns an object containing the original value.
How to return the converted instant right away insertion?