An update operation is defined by an UPDATE clause. The value of the UPDATE clause must be a JSON object or a JSON array. A WHERE and FILTER clauses are used to indicate which nodes should be replaced. The WHERE and FILTER clauses in the statement they must appear before the UPDATE clause.
An update can replace a root node or branches. If the WHERE clause matches a branch that branch is replaced. This allows global replaces of branches.
If a LIMIT clause is included the integer value is used as a validator. If a value of zero is provided then all matching nodes will be deleted before the update is inserted. If the value is one or more then no more than that many nodes are allowed to be updated. If there are more to be updated an error is returned and no action is taken.
Statements are evaluated asynchronously allowing multiple outstanding queries to be active. To support this an RID clause is allowed in the UPDATE statement. The value for the RID clause must be a string. The RID value is passed back in the query result.
The return from an UPDATE is a JSON Object. The contents of the result Object will be different depending on the success or failure of the evaluation. In all cases a code member will be present. A code value of zero indicates success. Any other value indicates an error.
On success the JSON object result will include a updated member that is an array of the references to all the updated records or rather the new references for those records.
If an RID was specified in the query then a rid member will also be included in the result Object.
If an error occurs during statement processing or the statement is not valid the JSON object result will include a error member describing the error.