Skip to content

Kotlin BSON • Multiplatform abstraction for different BSON implementationsopensavvy.ktmongo.bsonBsonValueReader

BsonValueReader

@LowLevelApi
interface BsonValueReader

Representation of a BSON value.

See the type to know which accessor to use. All other accessors will fail with a BsonReaderException.

To obtain instances of this interface, see BsonDocumentReader.read and BsonArrayReader.read.

Implementation constraints

Different implementations of BsonValueReader should be considered equal if they represent the same value, with the same type. That is, both values would result in the exact same BSON sent over the wire. The methods BsonValueReader.Companion.equals and BsonValueReader.Companion.hashCode are provided to facilitate implementation.

Types

Companion

object Companion

Properties

type

abstract val type: BsonType

The type of this value.

Functions

diff

@LowLevelApi
infix fun BsonValueReader.diff(other: BsonValueReader): String?

Analyzes the difference between two BSON values.

read

abstract fun <T : Any> read(type: KType, klass: KClass<T>): T?

Reads this reader into an instance of type.

readArray

@LowLevelApi
abstract fun readArray(): BsonArrayReader

readBinaryData

@LowLevelApi
abstract fun readBinaryData(): ByteArray

readBinaryDataType

@LowLevelApi
abstract fun readBinaryDataType(): UByte

readBoolean

@LowLevelApi
abstract fun readBoolean(): Boolean

readDateTime

@LowLevelApi
abstract fun readDateTime(): Long

readDBPointerId

@LowLevelApi
abstract fun readDBPointerId(): ByteArray

readDBPointerNamespace

@LowLevelApi
abstract fun readDBPointerNamespace(): String

readDecimal128

@LowLevelApi
abstract fun readDecimal128(): ByteArray

readDocument

@LowLevelApi
abstract fun readDocument(): BsonDocumentReader

readDouble

@LowLevelApi
abstract fun readDouble(): Double

readInstant

@ExperimentalTime
@LowLevelApi
open fun readInstant(): Instant

Reads an Instant. Conversion function on top of readDateTime.

readInt32

@LowLevelApi
abstract fun readInt32(): Int

readInt64

@LowLevelApi
abstract fun readInt64(): Long

readJavaScript

@LowLevelApi
abstract fun readJavaScript(): String

readJavaScriptWithScope

@LowLevelApi
abstract fun readJavaScriptWithScope(): String

readMaxKey

@LowLevelApi
abstract fun readMaxKey()

readMinKey

@LowLevelApi
abstract fun readMinKey()

readNull

@LowLevelApi
abstract fun readNull()

readObjectId

@ExperimentalTime
@LowLevelApi
abstract fun readObjectId(): ObjectId

readObjectIdBytes

@LowLevelApi
abstract fun readObjectIdBytes(): ByteArray

readRegularExpressionOptions

@LowLevelApi
abstract fun readRegularExpressionOptions(): String

readRegularExpressionPattern

@LowLevelApi
abstract fun readRegularExpressionPattern(): String

readString

@LowLevelApi
abstract fun readString(): String

readSymbol

@LowLevelApi
abstract fun readSymbol(): String

readTimestamp

@LowLevelApi
abstract fun readTimestamp(): Timestamp

readUndefined

@LowLevelApi
abstract fun readUndefined()

toString

abstract override fun toString(): String

JSON representation of this value.