class CoroutineDatabase
(source)
A wrapper around MongoDatabase. Provides coroutine methods for Reactive Streams driver.
<init> |
A wrapper around MongoDatabase. Provides coroutine methods for Reactive Streams driver. CoroutineDatabase(database: MongoDatabase) |
codecRegistry |
Get the codec registry for the MongoDatabase. val codecRegistry: CodecRegistry |
database |
val database: MongoDatabase |
name |
Gets the name of the database. val name: String |
readConcern |
Get the read concern for the MongoCollection. val readConcern: ReadConcern |
readPreference |
Get the read preference for the MongoDatabase. val readPreference: ReadPreference |
writeConcern |
Get the write concern for the MongoDatabase. val writeConcern: WriteConcern |
createCollection |
Create a new collection with the selected options suspend fun createCollection(collectionName: String, options: CreateCollectionOptions = CreateCollectionOptions()): <ERROR CLASS> suspend fun createCollection(clientSession: ClientSession, collectionName: String, options: CreateCollectionOptions = CreateCollectionOptions()): <ERROR CLASS> |
createView |
Creates a view with the given name, backing collection/view name, aggregation pipeline, and options that defines the view. suspend fun createView(viewName: String, viewOn: String, pipeline: List<Bson>, createViewOptions: CreateViewOptions = CreateViewOptions()): <ERROR CLASS> suspend fun createView(clientSession: ClientSession, viewName: String, viewOn: String, pipeline: List<Bson>, createViewOptions: CreateViewOptions = CreateViewOptions()): <ERROR CLASS> |
drop |
Drops this database. suspend fun drop(): <ERROR CLASS> suspend fun drop(clientSession: ClientSession): <ERROR CLASS> |
dropCollection |
Drops this collection from the Database. suspend fun <T : Any> dropCollection(): <ERROR CLASS> suspend fun dropCollection(collectionName: String): <ERROR CLASS> |
getCollection |
Gets a collection, with a specific default document class. fun <TDocument : Any> getCollection(collectionName: String = KMongoUtil.defaultCollectionName(TDocument::class)): CoroutineCollection<TDocument> |
listCollectionNames |
Gets the names of all the collections in this database. suspend fun listCollectionNames(): List<String> suspend fun listCollectionNames(clientSession: ClientSession): List<String> |
listCollections |
Finds all the collections in this database. fun <TResult : Any> listCollections(): CoroutineListCollectionsPublisher<TResult> fun <TResult : Any> listCollections(clientSession: ClientSession): CoroutineListCollectionsPublisher<TResult> |
runCommand |
Executes command in the context of the current database. suspend fun <TResult> runCommand(command: Bson, readPreference: ReadPreference = this.readPreference): TResult? suspend fun <TResult> runCommand(clientSession: ClientSession, command: Bson, readPreference: ReadPreference = this.readPreference): TResult?
Executes the given command in the context of the current database with the given read preference. suspend fun <TResult : Any> runCommand(command: String, newReadPreference: ReadPreference = readPreference): TResult? |
watch |
Creates a change stream for this database. fun <TResult : Any> watch(pipeline: List<Bson> = emptyList()): CoroutineChangeStreamPublisher<TResult> fun <TResult : Any> watch(clientSession: ClientSession, pipeline: List<Bson> = emptyList()): CoroutineChangeStreamPublisher<TResult> |
withCodecRegistry |
Create a new MongoDatabase instance with a different codec registry. fun withCodecRegistry(codecRegistry: CodecRegistry): CoroutineDatabase |
withReadConcern |
Create a new MongoDatabase instance with a different read concern. fun withReadConcern(readConcern: ReadConcern): CoroutineDatabase |
withReadPreference |
Create a new MongoDatabase instance with a different read preference. fun withReadPreference(readPreference: ReadPreference): CoroutineDatabase |
withWriteConcern |
Create a new MongoDatabase instance with a different write concern. fun withWriteConcern(writeConcern: WriteConcern): CoroutineDatabase |