findOneAndDelete

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

Atomically find a document and remove it.

Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

Return

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

Parameters

filter

the query filter to find the document with

options

the options to apply to the operation


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

Atomically find a document and remove it.

Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

Return

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

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