Skip to content

BsonArray

Pure Kotlin BSON array implementation.

Implementation

Instead of decoding the BSON array into subdocuments, this class stores the raw bytes in BSON representation. Fields are decoded lazily when searched via the reader.

Because the reader is lazy, it is not thread-safe. If you want to use this instance without external synchronization, call eager.

Functions

eager

fun eager()

Scans this entire array recursively to find all the fields.

By default, BsonArray lazily scans for items. This is particularly beneficial if there is more data than you are interested in. However, this means the reader may discover items as it is being used, which is not thread-safe.

Instead, you can call this function to force a scan of the entire hierarchy. After this function returns, reader and all the values returned by it are thread-safe and immutable.

equals

open operator override fun equals(other: Any?): Boolean

hashCode

open override fun hashCode(): Int

reader

@LowLevelApi



open override fun reader(): BsonArrayReader

toByteArray

@LowLevelApi



open override fun toByteArray(): ByteArray

toString

open override fun toString(): String