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

replaceOneWithoutId

fun <T : Any> MongoCollection<T>.replaceOneWithoutId(filter: Bson, replacement: T, options: ReplaceOptions = ReplaceOptions()): Maybe<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 update one operation

fun <T : Any> MongoCollection<T>.replaceOneWithoutId(clientSession: ClientSession, filter: Bson, replacement: T, options: ReplaceOptions = ReplaceOptions()): Maybe<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

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 update one operation