createClient

fun createClient(): MongoClient

Creates a MongoClient instance with default connection string (localhost).


fun createClient(connectionString: String): MongoClient
fun createClient(connectionString: ConnectionString): MongoClient

Creates a MongoClient with the given connection string.


fun createClient(settings: MongoClientSettings): MongoClient

Creates a MongoClient with the given settings (the codec registry is updated with KMongo mapping).


fun createClient(javaClient: MongoClient): MongoClient

Wraps a Java sync driver client in a Kotlin sync driver client (they share the same connection pool, closing one closes the other).

The codec registry of the Java client is not modified: create it with createJavaClient to use the KMongo mapping.