encodeToBson
fun <T : Any> encodeToBson(context: BsonFactory, value: T, serializer: SerializationStrategy<T>): Bson(source)
Encodes an arbitrary value into a Bson document.
value must be serializable using KotlinX.Serialization. For example, using the @Serializable annotation.