MongoCluster

open class MongoCluster

The client-side representation of a MongoDB cluster operations.

The originating MongoClient is responsible for the closing of resources. If the originator MongoClient is closed, then any operations will fail.

Since

5.2

See also

Inheritors

Functions

Link copied to clipboard
suspend fun bulkWrite(models: List<ClientNamespacedWriteModel>): ClientBulkWriteResult

Executes a client-level bulk write operation. This method is functionally equivalent to bulkWrite(models, options) with the default options.

suspend fun bulkWrite(clientSession: ClientSession, models: List<ClientNamespacedWriteModel>): ClientBulkWriteResult

Executes a client-level bulk write operation. This method is functionally equivalent to bulkWrite(clientSession, models, options) with the default options.

suspend fun bulkWrite(models: List<ClientNamespacedWriteModel>, options: ClientBulkWriteOptions): ClientBulkWriteResult
suspend fun bulkWrite(clientSession: ClientSession, models: List<ClientNamespacedWriteModel>, options: ClientBulkWriteOptions): ClientBulkWriteResult

Executes a client-level bulk write operation.

Link copied to clipboard
fun getDatabase(databaseName: String): MongoDatabase

Gets a MongoDatabase instance for the given database name.

Link copied to clipboard

Get a list of the database names

fun listDatabaseNames(clientSession: ClientSession): Flow<String>

Gets the list of databases

Link copied to clipboard
@JvmName(name = "listDatabasesAsDocument")
fun listDatabases(): ListDatabasesFlow<Document>
@JvmName(name = "listDatabasesAsDocumentWithSession")
fun listDatabases(clientSession: ClientSession): ListDatabasesFlow<Document>
inline fun <T : Any> listDatabases(clientSession: ClientSession): ListDatabasesFlow<T>
fun <T : Any> listDatabases(resultClass: Class<T>): ListDatabasesFlow<T>
fun <T : Any> listDatabases(clientSession: ClientSession, resultClass: Class<T>): ListDatabasesFlow<T>

Gets the list of databases

Link copied to clipboard
suspend fun startSession(options: ClientSessionOptions = ClientSessionOptions.builder().build()): ClientSession

Creates a client session.

Link copied to clipboard
@Alpha(value = [Reason.CLIENT])
fun timeout(timeUnit: TimeUnit = TimeUnit.MILLISECONDS): Long?

The time limit for the full execution of an operation.

Link copied to clipboard
@JvmName(name = "watchAsDocument")
fun watch(pipeline: List<Bson> = emptyList()): ChangeStreamFlow<Document>
inline fun <T : Any> watch(pipeline: List<Bson> = emptyList()): ChangeStreamFlow<T>
@JvmName(name = "watchAsDocumentWithSession")
fun watch(clientSession: ClientSession, pipeline: List<Bson> = emptyList()): ChangeStreamFlow<Document>
inline fun <T : Any> watch(clientSession: ClientSession, pipeline: List<Bson> = emptyList()): ChangeStreamFlow<T>
fun <T : Any> watch(pipeline: List<Bson> = emptyList(), resultClass: Class<T>): ChangeStreamFlow<T>
fun <T : Any> watch(clientSession: ClientSession, pipeline: List<Bson> = emptyList(), resultClass: Class<T>): ChangeStreamFlow<T>

Creates a change stream for this client.

Link copied to clipboard
fun withCodecRegistry(newCodecRegistry: CodecRegistry): MongoCluster

Create a new MongoCluster instance with a different codec registry.

Link copied to clipboard
fun withReadConcern(newReadConcern: ReadConcern): MongoCluster

Create a new MongoCluster instance with a different read concern.

Link copied to clipboard
fun withReadPreference(newReadPreference: ReadPreference): MongoCluster

Create a new MongoCluster instance with a different read preference.

Link copied to clipboard
@Alpha(value = [Reason.CLIENT])
fun withTimeout(timeout: Long, timeUnit: TimeUnit = TimeUnit.MILLISECONDS): MongoCluster

Create a new MongoCluster instance with the set time limit for the full execution of an operation.

Link copied to clipboard
fun withWriteConcern(newWriteConcern: WriteConcern): MongoCluster

Create a new MongoCluster instance with a different write concern.

Properties

Link copied to clipboard
val codecRegistry: CodecRegistry

The codec registry.

Link copied to clipboard
val readConcern: ReadConcern

The read concern.

Link copied to clipboard
val readPreference: ReadPreference

The read preference.

Link copied to clipboard
val writeConcern: WriteConcern

The write concern.