kmongo / org.litote.kmongo.rxjava2 / com.mongodb.reactivestreams.client.MongoCollection / findOneAndDelete

findOneAndDelete

fun <T : Any> MongoCollection<T>.findOneAndDelete(filter: String, options: FindOneAndDeleteOptions = FindOneAndDeleteOptions()): Maybe<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

fun <T : Any> MongoCollection<T>.findOneAndDelete(clientSession: ClientSession, filter: String, options: FindOneAndDeleteOptions = FindOneAndDeleteOptions()): Maybe<T> (source)

Atomically find a document and remove it.

Parameters

clientSession - the client session

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