UPDATE statement, you can update specific fields within the documents based on specified conditions:
DQL
your_collection_nameis the name of the collection in which you want to update data.field1 = value1, field2.subfield = value2, ...represents the fields to be updated and their corresponding new value[condition]is the expression or set of conditions that determine which documents should be included in the result set.
Basic UPDATE
Here is an example of a basic UPDATE operation:DQL
UPDATE Multiple Fields
The following snippet shows an example of using UPDATE to set multiple fields:DQL
UPDATE with Nested Fields
Dot notation is available in 4.11 and later, with DQL_STRICT_MODE=false. Read more
MAP, specify the field-value pairs you want to update.
For MAP syntax, see Ditto Query Language > Types and Definitions > Map Operations.
Deleting Fields
UNSET is available in 4.11 and later.- When unsetting a
MAP, all children data types are iteratively unset. - Fields that are unset are ignored during subsequent DQL statements.
- Calling
UNSETon a large number of dynamically generated fields (for example, dynamically created keys in a CRDT map) may cause performance to degrade due to metadata accumulation over time. Benchmarks for this will vary depending on your dataset size and query cardinality. You can mitigate this accumulation by callingUNSETon a parent field (or deleting the document itself).