Skip to content

MongoDB driver for Kotlin (coroutines)opensavvy.ktmongo.coroutinesMongoCollection

MongoCollection

Properties

context

abstract val context: 

Functions

aggregate

Start an aggregation pipeline.

bulkWrite

abstract suspend fun bulkWrite(options: <Document>.() -> Unit = {}, filter: <Document>.() -> Unit = {}, operations: <Document>.() -> Unit)

Performs multiple update operations in a single request.

count

abstract suspend fun count(): Long

Counts how many documents exist in the collection.

abstract suspend fun count(options: <Document>.() -> Unit = {}, predicate: <Document>.() -> Unit): Long

Counts how many documents match predicate in the collection.

countEstimated

abstract suspend fun countEstimated(): Long

Counts all documents in the collection.

deleteMany

abstract suspend fun deleteMany(options: <Document>.() -> Unit = {}, filter: <Document>.() -> Unit)

Deletes all documents that match filter.

deleteOne

abstract suspend fun deleteOne(options: <Document>.() -> Unit = {}, filter: <Document>.() -> Unit)

Deletes the first document found that matches filter.

drop

abstract suspend fun drop(options: <Document>.() -> Unit = {})

Removes an entire collection from the database.

filter

Returns a filtered collection that only contains the elements that match filter.

find

abstract fun find(): MongoIterable<Document>

Finds all documents in this collection.

abstract fun find(options: <Document>.() -> Unit = {}, filter: <Document>.() -> Unit): MongoIterable<Document>

Finds all documents in this collection that satisfy filter.

findOne

open suspend fun findOne(options: <Document>.() -> Unit = {}, filter: <Document>.() -> Unit): Document?

Finds a document in this collection that satisfies filter.

findOneAndUpdate

abstract suspend fun findOneAndUpdate(options: <Document>.() -> Unit = {}, filter: <Document>.() -> Unit = {}, update: <Document>.() -> Unit): Document?

Updates one element that matches filter according to update and returns it, atomically.

insertMany

open suspend fun insertMany(vararg documents: Document, options: <Document>.() -> Unit = {})

Inserts multiple documents in a single operation.

abstract suspend fun insertMany(documents: Iterable<Document>, options: <Document>.() -> Unit = {})

Inserts multiple documents in a single operation.

insertOne

abstract suspend fun insertOne(document: Document, options: <Document>.() -> Unit = {})

Inserts a document.

updateMany

abstract suspend fun updateMany(options: <Document>.() -> Unit = {}, filter: <Document>.() -> Unit = {}, update: <Document>.() -> Unit)

Updates all documents that match filter according to update.

updateManyWithPipeline

abstract suspend fun updateManyWithPipeline(options: <Document>.() -> Unit = {}, filter: <Document>.() -> Unit = {}, update: <Document>.() -> Unit)

Updates all documents that match filter according to the update pipeline.

updateOne

abstract suspend fun updateOne(options: <Document>.() -> Unit = {}, filter: <Document>.() -> Unit = {}, update: <Document>.() -> Unit)

Updates a single document that matches filter according to update.

updateOneWithPipeline

abstract suspend fun updateOneWithPipeline(options: <Document>.() -> Unit = {}, filter: <Document>.() -> Unit = {}, update: <Document>.() -> Unit)

Updates a single document that matches filter according to the update pipeline.

upsertOne

abstract suspend fun upsertOne(options: <Document>.() -> Unit = {}, filter: <Document>.() -> Unit = {}, update: <Document>.() -> Unit)

Updates a single document that matches filter according to update.

upsertOneWithPipeline

abstract suspend fun upsertOneWithPipeline(options: <Document>.() -> Unit = {}, filter: <Document>.() -> Unit = {}, update: <Document>.() -> Unit)

Updates a single document that matches filter according to the update pipeline.