MongoDB request DSL • opensavvy.ktmongo.dsl.query • UpdateQuery • set
set¶
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¶
UpsertQuery.setOnInsert
Only set if a new document is created.
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¶
UpsertQuery.setOnInsert
Only set if a new document is created.