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:

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

Link copied to clipboard

Serializer for the multiplatform opensavvy.ktmongo.bson.multiplatform.BsonValue implementation.

Properties

Link copied to clipboard
open override val factory: BsonFactory
Link copied to clipboard
open override val type: BsonType

Functions

Link copied to clipboard
open override fun <T> decode(type: KType): T
Link copied to clipboard
open override fun decodeArray(): BsonArray
Link copied to clipboard
open override fun decodeBinaryData(): ByteArray
Link copied to clipboard
open override fun decodeBinaryDataType(): UByte
Link copied to clipboard
open override fun decodeBoolean(): Boolean
Link copied to clipboard
open override fun decodeDateTime(): Long
Link copied to clipboard
open override fun decodeDBPointerId(): ObjectId
Link copied to clipboard
open override fun decodeDBPointerNamespace(): String
Link copied to clipboard
Link copied to clipboard
open override fun decodeDocument(): BsonDocument
Link copied to clipboard
open override fun decodeDouble(): Double
Link copied to clipboard
Link copied to clipboard
open override fun decodeInt32(): Int
Link copied to clipboard
open override fun decodeInt64(): Long
Link copied to clipboard
open override fun decodeJavaScript(): String
Link copied to clipboard
open override fun decodeJavaScriptScope(): BsonDocument
Link copied to clipboard
open override fun decodeMaxKey()
Link copied to clipboard
open override fun decodeMinKey()
Link copied to clipboard
open override fun decodeNull(): Nothing?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun decodeString(): String
Link copied to clipboard
open override fun decodeSymbol(): String
Link copied to clipboard
open override fun decodeTimestamp(): Timestamp
Link copied to clipboard
open override fun decodeUndefined()
Link copied to clipboard
open fun decodeVector(): Vector
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
Link copied to clipboard
open override fun toString(): String