kmongo / org.litote.kmongo.coroutine / CoroutineClient

CoroutineClient

class CoroutineClient : Closeable (source)

A wrapper around MongoClient. Provides coroutine methods for Reactive Streams driver.

Constructors

<init>

A wrapper around MongoClient. Provides coroutine methods for Reactive Streams driver.

CoroutineClient(client: MongoClient)

Properties

client

val client: MongoClient

Functions

getDatabase

Gets the database with the given name.

fun getDatabase(name: String): CoroutineDatabase

listDatabaseNames

Get a list of the database names

suspend fun listDatabaseNames(): List<String>
suspend fun listDatabaseNames(clientSession: ClientSession): List<String>

listDatabases

Gets the list of databases

suspend fun <TResult> listDatabases(): List<TResult>
suspend fun <TResult> listDatabases(clientSession: ClientSession): List<TResult>

startSession

Creates a client session.

suspend fun startSession(): ClientSession
suspend fun startSession(options: ClientSessionOptions): ClientSession

watch

Creates a change stream for this client.

fun <TResult : Any> watch(pipeline: List<Bson> = emptyList()): CoroutineChangeStreamPublisher<TResult>
fun <TResult : Any> watch(clientSession: ClientSession, pipeline: List<Bson> = emptyList()): CoroutineChangeStreamPublisher<TResult>