BsonValue
Pure Kotlin implementation of opensavvy.ktmongo.bson.BsonValue.
The BSON specification only allows root documents, so it is not possible to instantiate this class directly with a complex structure. This class is used to decode the fields of a BsonDocument or the items of a BsonArray.
To instantiate a BsonDocument or BsonArray, see BsonFactory.
This page describes the BSON multiplatform implementation. To learn more about the general BSON operations, see opensavvy.ktmongo.bson.BsonValue.
Navigating BSON types
This class is part of the BSON trinity:
BsonDocument represents an entire BSON document.
BsonArray represents an array of BSON values.
BsonValue represents a single value in isolation.
Usage
If this BSON value is the serialized form of a Kotlin DTO, see decode.
This interface provides methods for decoding the different BSON native types, like decodeInt32, decodeObjectId and decodeInstant.
Some BSON types cannot be represented by a single Kotlin type, so multiple methods are provided to decode their components. For example: decodeRegularExpressionPattern and decodeRegularExpressionOptions.
Thread-safety
This class is not thread-safe. Although it is not possible to mutate its state, this class uses internal mutation to lazily decode the BSON stream.
Types
Serializer for the multiplatform opensavvy.ktmongo.bson.multiplatform.BsonValue implementation.