spring-data-mongodb
spring-data-mongodb copied to clipboard
Spring Data Mongo fails while converting the Document to Object type
We have a POJO class that contains the Map with key type as String and value type as Object (Map<String, Object>). Until version 3.1, the Document from DB is converted properly to Map<String, Object>. Once we upgraded to 3.2, the conversion is failing with an error,
org.springframework.data.mapping.MappingException: Expected to read Document Document{
The read method of MappingMongoConvertor had a statement,
if (typeToUse.equals(ClassTypeInformation.OBJECT)) { return (S) bson; }
But the above code is not available in the latest versions of the MappingMongoConvertor.
Please help us with how to solve this problem.
Thanks in advance.
If you'd like us to spend some time investigating, please take the time to provide a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem.
Hi @christophstrobl Thanks for the response. Ours is a very large project, so didn't share the sample. I will work on a small project with a similar use case and share it. Thanks again.
See also https://stackoverflow.com/questions/73689924/spring-data-mongo-conversion-is-not-working-for-object-type-since-version-3-2
Closing this one because we cannot reproduce the issue.