Skip to content

MongoDB request DSLopensavvy.ktmongo.dsl.queryUpdateQueryset

set

abstract infix fun <V> Field<T, V>.set(value: V)

Replaces the value of a field with the specified value.

Example

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

collection.filter {
    User::name eq "foo"
}.updateMany {
    User::age set 18
}

External resources

See also

open infix fun <V> KProperty1<T, V>.set(value: V)

Replaces the value of a field with the specified value.

Example

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

collection.filter {
    User::name eq "foo"
}.updateMany {
    User::age set 18
}

External resources

See also