BsonArrayReader

Utilities for decomposing a BsonArray into its elements.

To obtain an instance of this interface, see BsonArray.reader.

Example

val bson: BsonArray = …

for ((index, field) in bson.read().elements.withIndex()) {
println("[$index] • ${field.type}")
}

Properties

Link copied to clipboard

A list of all elements in this reader.

Functions

Link copied to clipboard
abstract fun asValue(): BsonValueReader

Reads this entire array as a BsonValueReader.

Link copied to clipboard
abstract fun read(index: Int): BsonValueReader?

Attempts to read an element at index index.

Link copied to clipboard
abstract fun toBson(): BsonArray

Reads this document into a BsonArray instance.

Link copied to clipboard
abstract override fun toString(): String

JSON representation of the array this BsonArrayReader is reading, as a String.