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
This causes the following error when attempting to decode objects even if they are {} in the database:
org.bson.BsonInvalidOperationException: readEndDocument can only be called when ContextType is DOCUMENT or SCOPE_DOCUMENT, not when ContextType is TOP_LEVEL.
at org.bson.AbstractBsonReader.throwInvalidContextType(AbstractBsonReader.java:654)
at org.bson.AbstractBsonReader.readEndDocument(AbstractBsonReader.java:347)
at com.github.jershell.kbson.FlexibleDecoder.endStructure(BsonFlexibleDecoder.kt:61)
at kotlinx.serialization.internal.ObjectSerializer.deserialize(ObjectSerializer.kt:57)
at kotlinx.serialization.encoding.Decoder$DefaultImpls.decodeSerializableValue(Decoding.kt:257)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:16)
at com.application.codec.CustomCodec.decode(CustomCodec.kt:71)
...
The text was updated successfully, but these errors were encountered:
I mean it seems pretty obvious that the beginStructure does not account for SerialKind.OBJECT, but the endStructure does. @ninja- Is this accounted for somewhere else that I missed?
NOTE: This may be a moot point as MongoDB has official drivers now.
When decoding a
SerialKind.OBJECT
theBsonFlexibleDecoder
does not start the document read, but it does end it.https://github.com/jershell/kbson/blob/master/src/main/kotlin/com/github/jershell/kbson/BsonFlexibleDecoder.kt#L61
This causes the following error when attempting to decode objects even if they are
{}
in the database:The text was updated successfully, but these errors were encountered: