Skip to content

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

deleteOne

abstract suspend fun deleteOne(options: ERROR CLASS: Symbol not found for DeleteOneOptions.() -> Unit = {}, filter: ERROR CLASS: Symbol not found for FilterQuery.() -> Unit)

Deletes the first document found that matches filter.

Example

class User(
    val name: String,
    val age: Int
)

collection.deleteOne {
    User::name eq "Bob"
}

External resources