UPDATE VERTEX¶
UPDATE VERTEX <vid> SET <update_columns>
[WHEN <condition>] [YIELD <columns>]
Use UPDATE VERTEX to update properties on a vertex. The UPDATE VERTEX statement only updates one tag of a vertex at a time.
Nebula Graph supports compare-and-set (CAS) operation.
NOTE:
WHENandYIELDare optional.
vidis the ID of the vertex to be updated.update_columnsis the properties of the vertex to be updated. For example,tag1.col1 = $^.tag2.col2 + 1means to updatetag1.col1totag2.col2+1.NOTE:
$^indicates the vertex to be updated.
conditionis some constraints. Only when the constraints are met,UPDATEis executed successfully.conditionsupports expression operations.columnsis the columns to be returned.YIELDreturns the latest updated values.
Consider the following example:
nebula> UPDATE VERTEX "player100" \
SET player.age = $^.player.age + 1 \
WHEN $^.player.name == "Tim Duncan" \
YIELD $^.player.name AS name, $^.player.age AS age;
+--------------+-----+
| name | age |
+--------------+-----+
| "Tim Duncan" | 43 |
+--------------+-----+
Last update: March 16, 2021