spring-data-mongodb
spring-data-mongodb copied to clipboard
Wrong type definition for Duration due to converter
When writing a duration type parameter to the database, Spring defines it as a String after using converters, it can be seen that JRS310Converters.DurationToStringConverter is being used, but I need its real type and not a modified one.
Now I have to write a strange converter that is used when writing to the database. I need exactly its type. further it is used for custom codec @WritingConverter class DurationToDurationConverter : Converter<Duration, Duration> { override fun convert(source: Duration): Duration = source }
There's room for improvement regarding custom Codec usage. The types it would need, to influence the ConverterConfiguration by eg. providing a filter that disables registration of default converters, are not visible and the MongoConverterConfigurationAdapter only exposes a very specific subset of what the ConverterConfiguration allows. We'll need to revisit that arrangement to be able to address the issue you describe.