UpdateQuery
DSL for MongoDB operators that are used to update existing values (does not include aggregation operators).
Example
This expression type is available on multiple operations, most commonly update:
class User(
val name: String,
val age: Int,
)
collection.update(
filter = {
User::name eq "Bob"
},
update = {
User::age set 18
}
)Operators
On regular fields:
On arrays:
Time management:
Bitwise operators:
If you can't find the operator you're searching for, visit the tracking issue.
External resources
See also
Filters
Inheritors
Types
Functions
Adds a new node as a child of this one.
Adds any number of nodes into this one.
Adds multiple values at the end of the array, unless they are already present.
Refers to child as a nested field of the current field.
Filters an array and performs the specified update only on the filtered items.
Makes this expression immutable.
Refers to a specific item in an array, by its index.
Refers to a specific item in a map, by its name.
Increments a field by the specified amount.
Removes the first element in the specified array.
Removes the last element in the specified array.
Removes all instances of value from the specified array.
Removes all items of an array that match predicate.
Removes all items of an array that match predicate.
Adds value at the end of the array.
Adds values to the end of the array with advanced options.
Sets this field to the current date.
Sets this field to the current timestamp.
Returns a simplified (but equivalent) expression to the current expression.
Multiplies a field by the specified amount.
Writes the result of simplifying to a new BsonDocument.
Writes the result of simplifying this expression into writer.