-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 4.10.0
-
Not Needed
-
Summary
Inserting POJO that has CharSequence field fails as of 4.10.0 library version. The error I am seeing is this:
kotlinx.serialization.SerializationException: Class 'String' is not registered for polymorphic serialization in the scope of 'CharSequence'. To be registered automatically, class 'String' has to be '@Serializable', and the base class 'CharSequence' has to be sealed and '@Serializable'. Alternatively, register the serializer for 'String' explicitly in a corresponding SerializersModule.
How to Reproduce
Please look at the attached example: mongo-example.zip. Just run Main class and the error will occur.
Additional Background
As soon as I change dependency to 4.9.1 the error goes away. Also if I exclude org.mongodb:bson-kotlinx from gradle dependency. So, we should have a way to not have Kotlin serializer as this is just java project and Kotlin serializer is throwing this error which we cannot fix.