BsonFactory

interface BsonFactory(source)

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

Link copied to clipboard

Instantiates a new BSON array.

Instantiates a new BSON array representing the provided instance.

Link copied to clipboard
abstract fun buildDocument(block: BsonFieldWriter.() -> Unit): Bson

Instantiates a new BSON document.

Instantiates a new BSON document representing the provided instance.

abstract fun <T : Any> buildDocument(obj: T, type: KType, klass: KClass<T>): Bson

Writes an arbitrary Kotlin obj into a top-level BSON document.

Link copied to clipboard

Instantiates a new BSON array by reading its bytes representation.

Link copied to clipboard
abstract fun readDocument(bytes: ByteArray): Bson

Instantiates a new BSON document by reading its bytes representation.

Link copied to clipboard
inline fun <T : Any> BsonFactory.write(obj: T): Bson

Writes an arbitrary Kotlin obj into a top-level BSON document.