kmongo / org.litote.kmongo.coroutine / CoroutineCollection / deleteOne

deleteOne

suspend fun deleteOne(filter: Bson, options: DeleteOptions = DeleteOptions()): DeleteResult (source)

Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.

Parameters

filter - the query filter to apply the the delete operation

options - the options to apply to the delete operation

Return
the DeleteResult or an com.mongodb.MongoException

Since
1.5

suspend fun deleteOne(clientSession: ClientSession, filter: Bson, options: DeleteOptions = DeleteOptions()): DeleteResult (source)

Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.

Parameters

clientSession - the client session with which to associate this operation

filter - the query filter to apply the the delete operation

options - the options to apply to the delete operation

Return
the DeleteResult or an com.mongodb.MongoException

Mongodb
.server.release 3.6

Since
1.7

suspend fun deleteOne(filter: String, deleteOptions: DeleteOptions = DeleteOptions()): DeleteResult (source)

Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.

Parameters

filter - the query filter to apply the the delete operation

Return
the result of the remove one operation

suspend fun deleteOne(clientSession: ClientSession, filter: String, deleteOptions: DeleteOptions = DeleteOptions()): DeleteResult (source)

Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.

Parameters

clientSession - the client session with which to associate this operation

filter - the query filter to apply the the delete operation

Return
the result of the remove one operation

suspend fun deleteOne(vararg filters: Bson?, deleteOptions: DeleteOptions = DeleteOptions()): DeleteResult (source)

Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.

Parameters

filters - the query filters to apply the the delete operation

Return
the result of the remove one operation

suspend fun deleteOne(clientSession: ClientSession, vararg filters: Bson?, deleteOptions: DeleteOptions = DeleteOptions()): DeleteResult (source)

Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.

Parameters

clientSession - the client session with which to associate this operation

filters - the query filters to apply the the delete operation

Return
the result of the remove one operation