I have a POJO, one field of which is a Map<String, Object>. At least one of these Objects is an Instant. POJO writes correctly to Mongo, a DATETIME field is written. When reading back however, it decodes into a java.util.Date because of the default type mappings applied to the MapCodec. I understand its possible to supply my own copy BsonTypeClassMap with overrides, but is that feasible in practice?
Normally, I construct my CodecRegistries as follows:
…custom codecs/providers for my classes,
.register([custom class models])
Given that the mongo default set of codecs are constructed without my custom type map, I don’t see any feasible way to set the map later. Is my only option to copy the code out of the driver into my own configuration class so that I can send in my custom type mappings at construction time?