Skip to content

MongoDB driver for Kotlin (synchronous)opensavvy.ktmongo.syncMongoCollection

MongoCollection

Properties

context

abstract val context: 

Functions

aggregate

Start an aggregation pipeline.

bulkWrite

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

Performs multiple update operations in a single request.

count

abstract fun count(): Long

Counts how many documents exist in the collection.

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

Counts how many documents match predicate in the collection.

countEstimated

abstract fun countEstimated(): Long

Counts all documents in the collection.

deleteMany

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

Deletes all documents that match filter.

deleteOne

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

Deletes the first document found that matches filter.

drop

abstract 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 fun findOne(options: <Document>.() -> Unit = {}, filter: <Document>.() -> Unit): Document?

Finds a document in this collection that satisfies filter.

findOneAndUpdate

abstract 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 fun insertMany(vararg documents: Document, options: <Document>.() -> Unit = {})

Inserts multiple documents in a single operation.

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

Inserts multiple documents in a single operation.

insertOne

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

Inserts a document.

updateMany

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

Updates all documents that match filter according to update.

updateManyWithPipeline

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

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

updateOne

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

Updates a single document that matches filter according to update.

updateOneWithPipeline

abstract 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 fun upsertOne(options: <Document>.() -> Unit = {}, filter: <Document>.() -> Unit = {}, update: <Document>.() -> Unit)

Updates a single document that matches filter according to update.

upsertOneWithPipeline

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

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