You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think in this line , it should access a custom codec registry that a user registered by MongoCollection::withCodecRegistry(registry). Because of this, it fails to find a codec and fails serialization.
The text was updated successfully, but these errors were encountered:
Thank you for reporting. Could you provide a reproducible use case ? I infer it does not work for for a collection class that use a custom codec ? For which mapping engine ?
Thanks. Yes, when a collection with a custom codec registry calls .replaceOne() (or any method depending on KMongoUtil.filterIdToBson()), it ignores the registered codec registry; it uses a KMongo internal shared codec registry in SerializationClassMappingTypeService instead. Not sure about mapping engines, our project uses Kotlinx Serialization for serialization, but I don't think it affects the root cause.
Workaround: add the codec in MongoClientSettings.codecRegistry in KMongo.createClient(MongoClientSettings). Needs a major refactoring to fix the bug because the KMongoUtil.filterIdToBson() is stateless
replaceOneById -> replaceOneWithoutId -> KMongoUtil.filterIdToBson -> SerializationClassMappingTypeService::filterIdToBson
I think in this line , it should access a custom codec registry that a user registered by
MongoCollection::withCodecRegistry(registry)
. Because of this, it fails to find a codec and fails serialization.The text was updated successfully, but these errors were encountered: