kmongo / org.litote.kmongo.coroutine / CoroutineCollection / findOneAndDelete

findOneAndDelete

suspend fun findOneAndDelete(filter: Bson, options: FindOneAndDeleteOptions = FindOneAndDeleteOptions()): T? (source)

Atomically find a document and remove it.

Parameters

filter - the query filter to find the document with

options - the options to apply to the operation

Return
the document that was removed. If no documents matched the query filter, then null will be returned

suspend fun findOneAndDelete(clientSession: ClientSession, filter: Bson, options: FindOneAndDeleteOptions = FindOneAndDeleteOptions()): T? (source)

Atomically find a document and remove it.

Parameters

clientSession - the client session with which to associate this operation

filter - the query filter to find the document with

options - the options to apply to the operation

Return
a publisher with a single element the document that was removed. If no documents matched the query filter, then null will be returned

Mongodb
.server.release 3.6

Since
1.7

suspend fun findOneAndDelete(filter: String, options: FindOneAndDeleteOptions = FindOneAndDeleteOptions()): T? (source)

Atomically find a document and remove it.

Parameters

filter - the query filter to find the document with

options - the options to apply to the operation

Return
the document that was removed. If no documents matched the query filter, then null will be returned

suspend fun findOneAndDelete(clientSession: ClientSession, filter: String, options: FindOneAndDeleteOptions = FindOneAndDeleteOptions()): T? (source)

Atomically find a document and remove it.

Parameters

clientSession - the client session with which to associate this operation

filter - the query filter to find the document with

options - the options to apply to the operation

Return
the document that was removed. If no documents matched the query filter, then null will be returned