runCommand

abstract suspend fun runCommand(command: Bson): Document

Executes the given command in the context of the current database with a read preference of ReadPreference.primary.

Parameters

command

the command to be run


abstract suspend fun runCommand(command: Bson, readPreference: ReadPreference): Document

Executes the given command in the context of the current database with the given read preference.

Parameters

command

the command to be run

readPreference

the com.mongodb.ReadPreference to be used when executing the command


abstract suspend fun <TResult : Any> runCommand(command: Bson, resultClass: KClass<out TResult>): TResult

Executes the given command in the context of the current database with a read preference of ReadPreference.primary.

Parameters

command

the command to be run

resultClass

the default class to cast any documents returned from the database into.

the type of the class to use instead of `Document`.

abstract suspend fun <TResult : Any> runCommand(    command: Bson,     readPreference: ReadPreference,     resultClass: KClass<out TResult>): TResult

Executes the given command in the context of the current database with the given read preference.

Parameters

command

the command to be run

readPreference

the com.mongodb.ReadPreference to be used when executing the command

resultClass

the default class to cast any documents returned from the database into.

the type of the class to use instead of `Document`.

abstract suspend fun runCommand(clientSession: ClientSession, command: Bson): Document

Executes the given command in the context of the current database with a read preference of ReadPreference.primary.

Since

3.6

Parameters

clientSession

the client session with which to associate this operation

command

the command to be run


abstract suspend fun runCommand(    clientSession: ClientSession,     command: Bson,     readPreference: ReadPreference): Document

Executes the given command in the context of the current database with the given read preference.

Since

3.6

Parameters

clientSession

the client session with which to associate this operation

command

the command to be run

readPreference

the ReadPreference to be used when executing the command


abstract suspend fun <TResult : Any> runCommand(    clientSession: ClientSession,     command: Bson,     resultClass: KClass<out TResult>): TResult

Executes the given command in the context of the current database with a read preference of ReadPreference.primary.

Since

3.6

Parameters

clientSession

the client session with which to associate this operation

command

the command to be run

resultClass

the default class to cast any documents returned from the database into.

the type of the class to use instead of `Document`.

abstract suspend fun <TResult : Any> runCommand(    clientSession: ClientSession,     command: Bson,     readPreference: ReadPreference,     resultClass: KClass<out TResult>): TResult

Executes the given command in the context of the current database with the given read preference.

Since

3.6

Parameters

clientSession

the client session with which to associate this operation

command

the command to be run

readPreference

the com.mongodb.ReadPreference to be used when executing the command

resultClass

the default class to cast any documents returned from the database into.

the type of the class to use instead of `Document`.