updateMany

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

Update all documents in the collection according to the specified arguments.

Return

the result of the update many operation

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

See also

Throws

MongoWriteException

if the write failed due to some specific write exception

MongoWriteConcernException

if the write failed due to being unable to fulfil the write concern

MongoCommandException

if the write failed due to a specific command exception

MongoException

if the write failed due some other failure


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

Update all documents in the collection according to the specified arguments.

Return

the result of the update many operation

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

See also

Throws

MongoWriteException

if the write failed due to some specific write exception

MongoWriteConcernException

if the write failed due to being unable to fulfil the write concern

MongoCommandException

if the write failed due to a specific command exception

MongoException

if the write failed due some other failure


suspend fun updateMany(filter: Bson, update: List<Bson>, options: UpdateOptions = UpdateOptions()): UpdateResult

Update all documents in the collection according to the specified arguments.

Return

the result of the update many operation

Parameters

filter

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

update

a pipeline describing the update, which may not be null.

options

the options to apply to the update operation

See also

Throws

MongoWriteException

if the write failed due some other failure specific to the update command

MongoWriteConcernException

if the write failed due being unable to fulfil the write concern

MongoException

if the write failed due some other failure


suspend fun updateMany(clientSession: ClientSession, filter: Bson, update: List<Bson>, options: UpdateOptions = UpdateOptions()): UpdateResult

Update all documents in the collection according to the specified arguments.

Return

the result of the update many operation

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 pipeline describing the update, which may not be null.

options

the options to apply to the update operation

See also

Throws

MongoWriteException

if the write failed due some other failure specific to the update command

MongoWriteConcernException

if the write failed due being unable to fulfil the write concern

MongoException

if the write failed due some other failure