Skip to content

Type check should be a little more relaxed #4

Description

@zigzago

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions