kmongo / org.litote.kmongo / com.mongodb.client.MongoCollection / updateMany

updateMany

fun <T : Any> MongoCollection<T>.updateMany(filter: String, update: String, updateOptions: UpdateOptions = UpdateOptions()): UpdateResult (source)

Update all documents 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.

updateOptions - the options to apply to the update operation

Exceptions

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>.updateMany(filter: Bson, vararg updates: SetTo<*>, updateOptions: UpdateOptions = UpdateOptions()): UpdateResult (source)

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

Parameters

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

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

updateOptions - the options to apply to the update operation

Exceptions

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>.updateMany(clientSession: ClientSession, filter: String, update: String, updateOptions: UpdateOptions = UpdateOptions()): UpdateResult (source)

Update all documents 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.

updateOptions - the options to apply to the update operation

Exceptions

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>.updateMany(clientSession: ClientSession, filter: Bson, vararg updates: SetTo<*>, updateOptions: UpdateOptions = UpdateOptions()): UpdateResult (source)

Update all documents 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.

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

updateOptions - the options to apply to the update operation

Exceptions

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