kmongo / org.litote.kmongo.coroutine / CoroutineCollection / updateOne

updateOne

suspend fun updateOne(filter: Bson, update: Bson, options: UpdateOptions = UpdateOptions()): UpdateResult (source)

Update a single document in the collection according to the specified arguments.

Parameters

filter - a document describing the query filter, which may not be null.

update - a document describing the update, which may not be null. The update to apply must include only update operators.

options - the options to apply to the update operation

Return
the UpdateResult

Mongodb
.driver.manual tutorial/modify-documents/ Updates

Mongodb
.driver.manual reference/operator/update/ Update Operators

suspend fun updateOne(clientSession: ClientSession, filter: Bson, update: Bson, options: UpdateOptions = UpdateOptions()): UpdateResult (source)

Update a single document in the collection according to the specified arguments.

Parameters

clientSession - the client session with which to associate this operation

filter - a document describing the query filter, which may not be null.

update - a document describing the update, which may not be null. The update to apply must include only update operators.

options - the options to apply to the update operation

Return
the UpdateResult

Mongodb
.driver.manual tutorial/modify-documents/ Updates

Mongodb
.driver.manual reference/operator/update/ Update Operators

Mongodb
.server.release 3.6

Since
1.7

suspend fun updateOne(filter: String, update: String, options: UpdateOptions = UpdateOptions()): UpdateResult (source)

Update a single document in the collection according to the specified arguments.

Parameters

filter - a document describing the query filter

update - a document describing the update. The update to apply must include only update operators.

options - the options to apply to the update operation

Return
the result of the update one operation

suspend fun updateOne(clientSession: ClientSession, filter: String, update: String, options: UpdateOptions = UpdateOptions()): UpdateResult (source)

Update a single document in the collection according to the specified arguments.

Parameters

clientSession - the client session with which to associate this operation

filter - a document describing the query filter

update - a document describing the update. The update to apply must include only update operators.

options - the options to apply to the update operation

Return
the result of the update one operation

suspend fun updateOne(filter: String, update: Any, options: UpdateOptions = UpdateOptions(), updateOnlyNotNullProperties: Boolean = UpdateConfiguration.updateOnlyNotNullProperties): UpdateResult (source)

Update a single document in the collection according to the specified arguments.

Parameters

filter - a document describing the query filter

update - the update object

options - the options to apply to the update operation

updateOnlyNotNullProperties - if true do not change null properties

Return
the result of the update one operation

suspend fun updateOne(clientSession: ClientSession, filter: String, update: Any, options: UpdateOptions = UpdateOptions(), updateOnlyNotNullProperties: Boolean = UpdateConfiguration.updateOnlyNotNullProperties): UpdateResult (source)

Update a single document in the collection according to the specified arguments.

Parameters

clientSession - the client session with which to associate this operation

filter - a document describing the query filter

update - the update object

options - the options to apply to the update operation

updateOnlyNotNullProperties - if true do not change null properties

Return
the result of the update one operation

suspend fun updateOne(filter: Bson, target: T, options: UpdateOptions = UpdateOptions(), updateOnlyNotNullProperties: Boolean = UpdateConfiguration.updateOnlyNotNullProperties): UpdateResult (source)

Update a single document in the collection according to the specified arguments.

Parameters

filter - a document describing the query filter

target - the update object - must have an non null id

options - the options to apply to the update operation

updateOnlyNotNullProperties - if true do not change null properties

Return
the result of the update one operation

suspend fun updateOne(clientSession: ClientSession, filter: Bson, target: T, options: UpdateOptions = UpdateOptions(), updateOnlyNotNullProperties: Boolean = UpdateConfiguration.updateOnlyNotNullProperties): UpdateResult (source)

Update a single document in the collection according to the specified arguments.

Parameters

clientSession - the client session with which to associate this operation

filter - a document describing the query filter

target - the update object - must have an non null id

options - the options to apply to the update operation

updateOnlyNotNullProperties - if true do not change null properties

Return
the result of the update one operation