kmongo / org.litote.kmongo.coroutine / CoroutineCollection / replaceOneWithoutId

replaceOneWithoutId

suspend fun <T : Any> replaceOneWithoutId(filter: Bson, replacement: T, options: ReplaceOptions = ReplaceOptions()): UpdateResult (source)

Replace a document in the collection according to the specified arguments. The id of the provided document is not used, in order to avoid updated id error. You may have to use UpdateResult.getUpsertedId in order to retrieve the generated id.

Parameters

filter - the query filter to apply to the replace operation

replacement - the replacement document

options - the options to apply to the replace operation

Return
the result of the replace one operation

suspend fun replaceOneWithoutId(clientSession: ClientSession, filter: Bson, replacement: T, options: ReplaceOptions = ReplaceOptions()): UpdateResult (source)

Replace a document in the collection according to the specified arguments. The id of the provided document is not used, in order to avoid updated id error. You may have to use UpdateResult.getUpsertedId in order to retrieve the generated id.

Parameters

clientSession - the client session with which to associate this operation

filter - the query filter to apply to the replace operation

replacement - the replacement document

options - the options to apply to the replace operation

Return
the result of the replace one operation