Spring data mongo conversion is not working for Object type since version 3.2

Viewed 32

We have upgraded the Spring Data Mongo recently and since then some read and update queries are failing with the following error,

org.springframework.data.mapping.MappingException: Expected to read Document Document{} into type class java.lang.Object but didn't find a PersistentEntity for the latter!

While debugging, found that the type is Object and it doesn't have _class then this error is thrown.

It was working fine before 3.2.

When checked in the 3.1's source code, the read method in class MappingMongoConverter has a logic to cast the bson to an Object type if the ClassTypeInfomartion is Object.

In a few of our object models, we store additional information about the document as an Object.

Is it possible to configure in Spring to convert the bson to Object instead of failing?

Thanks in advance.

0 Answers
Related