BsonFieldWriter¶
@LowLevelApi
interface BsonFieldWriter : AnyBsonWriter
Generator of BSON document fields.
This interface is used to write fields in a BSON document.
To write generic values, see BsonValueWriter.
Instances of this interface are commonly obtained by calling the BsonContext.buildDocument function.
Functions¶
write¶
@LowLevelApi
abstract fun write(name: String, block: BsonValueWriter.() -> Unit)
writeArray¶
@LowLevelApi
abstract fun writeArray(name: String, block: BsonValueWriter.() -> Unit)
writeBinaryData¶
@LowLevelApi
abstract fun writeBinaryData(
name: String,
type: UByte,
data: ByteArray
)
writeBoolean¶
@LowLevelApi
abstract fun writeBoolean(name: String, value: Boolean)
writeDateTime¶
@LowLevelApi
abstract fun writeDateTime(name: String, value: Long)
writeDBPointer¶
@LowLevelApi
abstract fun writeDBPointer(
name: String,
namespace: String,
id: ByteArray
)
Deprecated¶
This functionality is deprecated in the BSON specification. See https://bsonspec.org/spec.html
writeDecimal128¶
@LowLevelApi
abstract fun writeDecimal128(
name: String,
low: Long,
high: Long
)
writeDocument¶
@LowLevelApi
abstract fun writeDocument(name: String, block: BsonFieldWriter.() -> Unit)
writeDouble¶
@LowLevelApi
abstract fun writeDouble(name: String, value: Double)
writeInstant¶
@LowLevelApi
open fun writeInstant(name: String, value: Instant)
Writes an Instant. Conversion function on top of writeDateTime.
writeInt32¶
@LowLevelApi
abstract fun writeInt32(name: String, value: Int)
@LowLevelApi
open fun writeInt32(name: String, value: Short)
@LowLevelApi
open fun writeInt32(name: String, value: Byte)
writeInt64¶
@LowLevelApi
abstract fun writeInt64(name: String, value: Long)
writeJavaScript¶
@LowLevelApi
abstract fun writeJavaScript(name: String, code: String)
writeJavaScriptWithScope¶
@LowLevelApi
abstract fun writeJavaScriptWithScope(name: String, code: String)
Deprecated¶
This functionality is deprecated in the BSON specification. See https://bsonspec.org/spec.html
writeMaxKey¶
@LowLevelApi
abstract fun writeMaxKey(name: String)
writeMinKey¶
@LowLevelApi
abstract fun writeMinKey(name: String)
writeNull¶
writeObjectId¶
@LowLevelApi
abstract fun writeObjectId(name: String, id: ByteArray)
@LowLevelApi
abstract fun writeObjectId(name: String, id: ObjectId)
writeObjectSafe¶
@LowLevelApi
abstract fun <T> writeObjectSafe(name: String, obj: T)
Writes an arbitrary obj into a BSON document.
All nested values are escaped as necessary such that the result is a completely inert BSON document.
writeRegularExpression¶
@LowLevelApi
abstract fun writeRegularExpression(
name: String,
pattern: String,
options: String
)
writeString¶
@LowLevelApi
abstract fun writeString(name: String, value: String)
writeSymbol¶
@LowLevelApi
abstract fun writeSymbol(name: String, value: String)
Deprecated¶
This functionality is deprecated in the BSON specification. See https://bsonspec.org/spec.html
writeTimestamp¶
@LowLevelApi
abstract fun writeTimestamp(name: String, value: Timestamp)
writeUndefined¶
@LowLevelApi
abstract fun writeUndefined(name: String)
Deprecated¶
This functionality is deprecated in the BSON specification. See https://bsonspec.org/spec.html
writeVector¶
@LowLevelApi
open fun writeVector(name: String, vector: Vector)