Skip to content

Kotlin BSON • Based on the official MongoDB implementationopensavvy.ktmongo.bson.officialJvmBsonFactory

JvmBsonFactory

fun JvmBsonFactory(codecRegistry: CodecRegistry): JvmBsonFactory

Instantiates a new BsonFactory that respects the configuration in the specified codecRegistry.

Objects created by this factory internally use the official BSON Java library.

Note that the JvmBsonFactory.codecRegistry attribute may be different from the passed codecRegistry. In particular, this function adds new codecs for KtMongo-specific types. If mixing KtMongo with the official driver, we recommend configuring the official driver with the JvmBsonFactory.codecRegistry generated by this function. Otherwise, the official driver may serialize KtMongo types differently.