Mongo Client
A client-side representation of a MongoDB cluster. Instances can represent either a standalone MongoDB instance, a replica set, or a sharded cluster. Instance of this class are responsible for maintaining an up-to-date state of the cluster, and possibly cache resources related to this, including background threads for monitoring, and connection pools.
Instance of this class serve as factories for {@code MongoDatabase} instances.
Since
3.0
Types
Functions
Link copied to clipboard
Gets the database with the given name.
Link copied to clipboard
abstract fun listDatabaseNames(clientSession: ClientSession): Flow<String>
Content copied to clipboard
Get a list of the database names
Link copied to clipboard
abstract fun listDatabases(clientSession: ClientSession): ListDatabasesFlow<Document>
Content copied to clipboard
abstract fun <TResult : Any> listDatabases(resultClass: KClass<out TResult>): ListDatabasesFlow<TResult>
Content copied to clipboard
abstract fun <TResult : Any> listDatabases(clientSession: ClientSession, resultClass: KClass<out TResult>): ListDatabasesFlow<TResult>
Content copied to clipboard
Gets the list of databases
Link copied to clipboard
Creates a client session with default options.
abstract suspend fun startSession(options: ClientSessionOptions): ClientSession
Content copied to clipboard
Creates a client session.
Link copied to clipboard
abstract fun watch(clientSession: ClientSession): ChangeStreamFlow<Document>
Content copied to clipboard
abstract fun <TResult : Any> watch(resultClass: KClass<out TResult>): ChangeStreamFlow<TResult>
Content copied to clipboard
abstract fun watch(clientSession: ClientSession, pipeline: List<Bson>): ChangeStreamFlow<Document>
Content copied to clipboard
abstract fun <TResult : Any> watch(clientSession: ClientSession, resultClass: KClass<out TResult>): ChangeStreamFlow<TResult>
Content copied to clipboard
abstract fun <TResult : Any> watch(pipeline: List<Bson>, resultClass: KClass<out TResult>): ChangeStreamFlow<TResult>
Content copied to clipboard
abstract fun <TResult : Any> watch( clientSession: ClientSession, pipeline: List<Bson>, resultClass: KClass<out TResult>): ChangeStreamFlow<TResult>
Content copied to clipboard
Creates a change stream for this client.