Skip to content

BsonContext

BSON configuration for the objects generated by the DSL.

This object is passed through the entire DSL to allow accessing the configuration from anywhere during request generation.

Constructors

BsonContext

@ExperimentalAtomicApi
fun BsonContext(
    bsonFactory: BsonFactory, 
    objectIdGenerator: ObjectIdGenerator = ObjectIdGenerator.Default(), 
    nameStrategy: PropertyNameStrategy = PropertyNameStrategy.Default
): BsonContext

BSON configuration for the objects generated by the DSL.

Functions

buildArray

@LowLevelApi



abstract fun buildArray(block: BsonValueWriter.() -> Unit): BsonArray
@LowLevelApi



open fun buildArray(instance: BsonValueWriteable): BsonArray

buildDocument

@LowLevelApi



abstract fun buildDocument(block: BsonFieldWriter.() -> Unit): Bson
@LowLevelApi



open fun buildDocument(instance: BsonFieldWriteable): Bson
@LowLevelApi



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

newId

abstract fun newId(): ObjectId

pathOf

@LowLevelApi



abstract fun pathOf(property: KProperty1<*, *>): Path

Generates the name of a property.

readArray

@LowLevelApi



abstract fun readArray(bytes: ByteArray): BsonArray

readDocument

@LowLevelApi



abstract fun readDocument(bytes: ByteArray): Bson