spring-data-mongodb
spring-data-mongodb copied to clipboard
MappingMongoConverter cast map's key to String, but ask for any Object, so why?
Lines:
https://github.com/spring-projects/spring-data-mongodb/blob/45971b212c12c67e4233d1b139de06ba088e18ee/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/MappingMongoConverter.java#L1073
https://github.com/spring-projects/spring-data-mongodb/blob/45971b212c12c67e4233d1b139de06ba088e18ee/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/MappingMongoConverter.java#L1074
Why it is checked for String and then ask for conversion for Object and cast to String?
Sorry it took so long to get back to you. Thanks for bringing this to our attention! Do you want to submit a PR or should we take care of this?
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.
HI @christophstrobl to understand the issue, the problem is that we're re computing same thing again right?, of checking for possible converter
so instead of doing the ternary operator we can do
String convertedSimpleWrite = (String) getPotentiallyConvertedSimpleWrite(key, String.class);
return Optional.ofNullable(convertedSimpleWrite).orElse(key.toString());
right?
@christophstrobl @mp911de is this still relevent? if so, can you please let me know on the above query?
@christophstrobl Hi, just flagging this again in case you missed it