BsonValue

Implementation of opensavvy.ktmongo.bson.BsonValue based on the official MongoDB drivers.

The BSON specification only allows root documents, so it is not possible to instantiate this interface directly with a complex structure. This interface 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 implementation based on the official MongoDB drivers. To learn more about the general BSON operations, see opensavvy.ktmongo.bson.BsonArray.

Navigating BSON types

This interface 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.

Implementation of a KtMongo opensavvy.ktmongo.bson.BsonValue that wraps a org.bson.BsonValue.

To create an instance of this class, see BsonFactory.readValue.

Types

Link copied to clipboard
expect object Serializer : KSerializer<BsonValue>

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

actual object Serializer : KSerializer<BsonValue>

Properties

Link copied to clipboard
expect open override val factory: BsonFactory
actual open override val factory: BsonFactory
Link copied to clipboard
val raw: BsonValue
Link copied to clipboard
abstract val type: BsonType
open override val type: BsonType

Functions

Link copied to clipboard
abstract fun <T> decode(type: KType): T
open override fun <T> decode(type: KType): T
Link copied to clipboard
expect open override fun decodeArray(): BsonArray
actual open override fun decodeArray(): BsonArray
Link copied to clipboard
abstract fun decodeBinaryData(): ByteArray
open override fun decodeBinaryData(): ByteArray
Link copied to clipboard
abstract fun decodeBinaryDataType(): UByte
open override fun decodeBinaryDataType(): UByte
Link copied to clipboard
abstract fun decodeBoolean(): Boolean
open override fun decodeBoolean(): Boolean
Link copied to clipboard
abstract fun decodeDateTime(): Long
open override fun decodeDateTime(): Long
Link copied to clipboard
abstract fun decodeDBPointerId(): ObjectId
open override fun decodeDBPointerId(): ObjectId
Link copied to clipboard
open override fun decodeDBPointerNamespace(): String
Link copied to clipboard
Link copied to clipboard
expect open override fun decodeDocument(): BsonDocument
actual open override fun decodeDocument(): BsonDocument
Link copied to clipboard
abstract fun decodeDouble(): Double
open override fun decodeDouble(): Double
Link copied to clipboard
Link copied to clipboard
abstract fun decodeInt32(): Int
open override fun decodeInt32(): Int
Link copied to clipboard
abstract fun decodeInt64(): Long
open override fun decodeInt64(): Long
Link copied to clipboard
abstract fun decodeJavaScript(): String
open override fun decodeJavaScript(): String
Link copied to clipboard
open override fun decodeJavaScriptScope(): BsonDocument
Link copied to clipboard
abstract fun decodeMaxKey()
open override fun decodeMaxKey()
Link copied to clipboard
abstract fun decodeMinKey()
open override fun decodeMinKey()
Link copied to clipboard
abstract fun decodeNull(): Nothing?
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
abstract fun decodeString(): String
open override fun decodeString(): String
Link copied to clipboard
abstract fun decodeSymbol(): String
open override fun decodeSymbol(): String
Link copied to clipboard
abstract fun decodeTimestamp(): Timestamp
open override fun decodeTimestamp(): Timestamp
Link copied to clipboard
abstract fun decodeUndefined()
open override fun decodeUndefined()
Link copied to clipboard
open fun decodeVector(): Vector
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