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

replaceOne

fun <reified T : Any> MongoCollection<T>.replaceOne(replacement: T, options: ReplaceOptions = ReplaceOptions()): Maybe<UpdateResult> (source)

Replace a document in the collection according to the specified arguments.

Parameters

replacement - the document to replace - must have an non null id

options - the options to apply to the replace operation

fun <reified T : Any> MongoCollection<T>.replaceOne(clientSession: ClientSession, replacement: T, options: ReplaceOptions = ReplaceOptions()): Maybe<UpdateResult> (source)

Replace a document in the collection according to the specified arguments.

Parameters

clientSession - the client session

replacement - the document to replace - must have an non null id

options - the options to apply to the replace operation

fun <T : Any> MongoCollection<T>.replaceOne(filter: String, replacement: T, options: ReplaceOptions = ReplaceOptions()): Maybe<UpdateResult> (source)

Replace a document in the collection according to the specified arguments.

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>.replaceOne(clientSession: ClientSession, filter: String, replacement: T, options: ReplaceOptions = ReplaceOptions()): Maybe<UpdateResult> (source)

Replace a document in the collection according to the specified arguments.

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