BsonArray

A BSON array.

To create instances of this class, see BsonFactory.

Navigating BSON types

This interface is part of the BSON trinity:

Usage

val bson: BsonArray = …

for (element in bson) {
println("Element: $element")
}

Equality

Different implementations of this interface are 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 BsonArray.Companion.equals and BsonArray.Companion.hashCode are provided as default implementations.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val factory: BsonFactory

The instance of BsonFactory that created this instance.

Link copied to clipboard
open val indices: IntRange
Link copied to clipboard
open val lastIndex: Int
Link copied to clipboard
abstract val size: Int

The number of items in this array.

Functions

Link copied to clipboard
abstract fun asIterable(): Iterable<BsonValue>

Creates an Iterable that wraps this array.

Link copied to clipboard
abstract fun asList(): List<BsonValue>

Creates a List view of this array.

Link copied to clipboard
abstract fun asSequence(): Sequence<BsonValue>

Creates a Sequence of the items in this array.

Link copied to clipboard
abstract fun asValue(): BsonValue

Returns the BsonValue equivalent to this array.

Link copied to clipboard
abstract fun <T> decode(type: KType): T

Decodes this array into an instance of the Kotlin type T.

Link copied to clipboard
inline fun <T> BsonArray.decode(): T

Decodes this array into an instance of the Kotlin type T.

Link copied to clipboard
open fun <T> decodeElements(type: KType): List<T>

Decodes this array into a List of the Kotlin type T.

Link copied to clipboard
inline fun <T> BsonArray.decodeElements(): List<T>

Decodes this array into a List of the Kotlin type T.

Link copied to clipboard
infix fun BsonArray.diff(other: BsonArray): String?

Analyzes the difference between two BSON arrays.

Link copied to clipboard
abstract operator fun get(index: Int): BsonValue?

Returns the element in the array at index.

Link copied to clipboard
open fun isEmpty(): Boolean

Returns true if this array has no elements.

Link copied to clipboard
open fun isNotEmpty(): Boolean

Returns true if this array has at least one element.

Link copied to clipboard
abstract operator fun iterator(): Iterator<BsonValue>

Iterates over the elements in this array.

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

JSON representation of this BsonArray, as a String.

Link copied to clipboard

Iterates over this array, returning both each item and its index.