kbson
kbson copied to clipboard
Type check should be a little more relaxed
I have an object with a Long property, but the value is stored as Double. When I try to deserialize it:
org.bson.BsonInvalidOperationException: Value expected to be of type INT64 is of unexpected type DOUBLE
at org.bson.BsonValue.throwIfInvalidType(BsonValue.java:419)
at org.bson.BsonValue.asInt64(BsonValue.java:105)
at com.github.jershell.kbson.BsonDocumentDecoder.decodeTaggedLong(BsonDocumentDecoder.kt:198)
at com.github.jershell.kbson.BsonDocumentDecoder.decodeTaggedLong(BsonDocumentDecoder.kt:30)
at kotlinx.serialization.TaggedDecoder.decodeLongElement(Tagged.kt:238)
It would be a nice addition to cast the value when it is doable
https://github.com/Litote/kmongo/issues/104