Kotlin BSON • Multiplatform abstraction for different BSON implementations • opensavvy.ktmongo.bson • BsonFactory
BsonFactory¶
interface BsonFactory
Entrypoint for creating Bson and BsonArray instances.
Instances of this interface are platform-specific and are used to create BSON documents. Each instance may allow parameterization of some behaviors.
Functions¶
buildArray¶
@LowLevelApi
abstract fun buildArray(block: BsonValueWriter.() -> Unit): BsonArray
Instantiates a new BSON array.
@LowLevelApi
open fun buildArray(instance: BsonValueWriteable): BsonArray
Instantiates a new BSON array representing the provided instance.
buildDocument¶
@LowLevelApi
abstract fun buildDocument(block: BsonFieldWriter.() -> Unit): Bson
Instantiates a new BSON document.
@LowLevelApi
open fun buildDocument(instance: BsonFieldWriteable): Bson
Instantiates a new BSON document representing the provided instance.
Writes an arbitrary Kotlin obj into a top-level BSON document.
readArray¶
Instantiates a new BSON array by reading its bytes representation.
readDocument¶
@LowLevelApi
abstract fun readDocument(bytes: ByteArray): Bson
Instantiates a new BSON document by reading its bytes representation.
write¶
Writes an arbitrary Kotlin obj into a top-level BSON document.