BsonDocument¶
@Serializable(with = BsonDocument.Serializer::class)
class BsonDocument : BsonDocument
Pure Kotlin implementation of opensavvy.ktmongo.bson.BsonDocument.
To create instances of this class, see BsonFactory.
This page describes the BSON multiplatform implementation. To learn more about the general BSON operations, see
opensavvy.ktmongo.bson.BsonDocument.
Navigating BSON types¶
This class is part of the BSON trinity:
-
BsonDocumentrepresents an entire BSON document. -
BsonArrayrepresents an array of BSON values. -
BsonValuerepresents a single value in isolation.
Usage¶
The iteration order of a BSON document is preserved: fields appear in the same order as they are written in.
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 BsonDocument.Companion.equals and BsonDocument.Companion.hashCode are provided as default implementations.
Thread-safety¶
This class is not thread-safe. Although it is not possible to mutate its state, this class uses internal mutation to lazily decode the BSON stream.
Types¶
Field¶
class Field(val name: String, val value: BsonValue) : BsonDocument.Field
Serializer¶
object Serializer : KSerializer<BsonDocument>
Serializer for the multiplatform opensavvy.ktmongo.bson.multiplatform.BsonDocument implementation.
Properties¶
factory¶
open override val factory: BsonFactory
fields¶
size¶
Functions¶
asIterable¶
open override fun asIterable(): Iterable<BsonDocument.Field>
asMap¶
asSequence¶
open override fun asSequence(): Sequence<BsonDocument.Field>
asValue¶
decode¶
@LowLevelApi
open override fun <T> decode(type: KType): T
equals¶
get¶
hashCode¶
isEmpty¶
isNotEmpty¶
open fun isNotEmpty(): Boolean
iterator¶
open operator override fun iterator(): Iterator<BsonDocument.Field>
toByteArray¶
open override fun toByteArray(): ByteArray