-
Type: Question
-
Resolution: Works as Designed
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
Summary
Servers like ktor is using StreamingJsonEncoder for the responses internaly but MongoDB ObjectId does not support StreamingJsonEncoder for the ...
kotlinx.serialization.SerializationException: ObjectId is not supported by class kotlinx.serialization.json.internal.StreamingJsonEncoder at org.bson.codecs.kotlinx.ObjectIdSerializer.serialize(BsonSerializers.kt:74) ~[bson-kotlinx-4.10.1.jar:?] at org.bson.codecs.kotlinx.ObjectIdSerializer.serialize(BsonSerializers.kt:66) ~[bson-kotlinx-4.10.1.jar:?] at kotlinx.serialization.json.internal.StreamingJsonEncoder.encodeSerializableValue(StreamingJsonEncoder.kt:228) ~[kotlinx-serialization-json-jvm-1.5.0.jar:?] at kotlinx.serialization.ContextualSerializer.serialize(ContextualSerializer.kt:63) ~[kotlinx-serialization-core-jvm-1.5.0.jar:1.5.0] at kotlinx.serialization.json.internal.StreamingJsonEncoder.encodeSerializableValue(StreamingJsonEncoder.kt:228) ~[kotlinx-serialization-json-jvm-1.5.0.jar:?]
How to Reproduce
When you want to send ObjectId value in the response of ktor server...
https://ktor.io/
(I'm tired and I didn't sleep for days dealing with MongoDb issues... please help the brother out)
- backported by
-
JAVA-5099 Driver is using Kotlin native serializer over custom Codec.
- Closed