updateOne

abstract suspend fun updateOne(filter: Bson, update: Bson): UpdateResult

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

Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

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.

Throws

com.mongodb.MongoWriteException
com.mongodb.MongoWriteConcernException
com.mongodb.MongoException

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

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

Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

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

Throws

com.mongodb.MongoWriteException
com.mongodb.MongoWriteConcernException
com.mongodb.MongoException

abstract suspend fun updateOne(    clientSession: ClientSession,     filter: Bson,     update: Bson): UpdateResult

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

Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

Since

3.6

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.

Throws

com.mongodb.MongoWriteException
com.mongodb.MongoWriteConcernException
com.mongodb.MongoException

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

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

Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

Since

3.6

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

Throws

com.mongodb.MongoWriteException
com.mongodb.MongoWriteConcernException
com.mongodb.MongoException