Skip to content

MongoDB driver for Kotlin (coroutines)opensavvy.ktmongo.coroutinesJvmMongoCollectionupdateManyWithPipeline

updateManyWithPipeline

open suspend override fun updateManyWithPipeline(options: UpdateOptions<Document>.() -> Unit, filter: FilterQuery<Document>.() -> Unit, update: UpdateWithPipelineQuery<Document>.() -> Unit)

Updates all documents that match filter according to the update pipeline.

Example

class User(
    val name: String,
    val age: Int,
)

collection.updateManyWithPipeline(
    filter = {
        User::name eq "Patrick"
    }
) {
    set {
        User::age set 15
    }
}

External resources

Parameters

filter

Optional filter to select which documents are updated. If no filter is specified, all documents are updated.

See also