fun <T> MongoCollection<T>.updateOneById(id: Any, update: Any, options: UpdateOptions = UpdateOptions(), updateOnlyNotNullProperties: Boolean = UpdateConfiguration.updateOnlyNotNullProperties): UpdateResult
(source)
Update a single document in the collection according to the specified arguments.
options
- the options to apply to the update operation
updateOnlyNotNullProperties
- if true do not change null properties
com.mongodb.MongoWriteException
- if the write failed due some other failure specific to the update command
com.mongodb.MongoWriteConcernException
- if the write failed due being unable to fulfil the write concern
com.mongodb.MongoException
- if the write failed due some other failure
Return
the result of the update one operation
fun <T : Any> MongoCollection<T>.updateOneById(id: Any, vararg updates: SetTo<*>, options: UpdateOptions = UpdateOptions()): UpdateResult
(source)
Update a single document in the collection according to the specified arguments.
updates
- the setTo describing the updates
options
- the options to apply to the update operation
com.mongodb.MongoWriteException
- if the write failed due some other failure specific to the update command
com.mongodb.MongoWriteConcernException
- if the write failed due being unable to fulfil the write concern
com.mongodb.MongoException
- if the write failed due some other failure
Return
the result of the update one operation
fun <T> MongoCollection<T>.updateOneById(clientSession: ClientSession, id: Any, update: Any, options: UpdateOptions = UpdateOptions(), updateOnlyNotNullProperties: Boolean = UpdateConfiguration.updateOnlyNotNullProperties): UpdateResult
(source)
Update a single document in the collection according to the specified arguments.
clientSession
- the client session with which to associate this operation
options
- the options to apply to the update operation
updateOnlyNotNullProperties
- if true do not change null properties
com.mongodb.MongoWriteException
- if the write failed due some other failure specific to the update command
com.mongodb.MongoWriteConcernException
- if the write failed due being unable to fulfil the write concern
com.mongodb.MongoException
- if the write failed due some other failure
Return
the result of the update one operation