SQL - UPDATE EDGE
Updates edge records in the current database. This is the equivalent of the UPDATE command, with the addition of checking and maintaining graph consistency with vertices, in the event that you update the out and in properties.
Bear in mind that OrientDB can also work in schema-less mode, allowing you to create fields on the fly. Furthermore, that it works on collections and necessarily includes some extensions to the standard SQL for handling collections.
This command was introduced in version 2.2.
Syntax
UPDATE EDGE <edge>
[SET|INCREMENT|ADD|REMOVE|PUT <field-name> = <field-value>[,]*]|[CONTENT|MERGE <JSON>]
[RETURN <returning> [<returning-expression>]]
[WHERE <conditions>]
[LOCK default|record]
[LIMIT <max-records>] [TIMEOUT <timeout>]
<edge>Defines the edge that you want to update. You can choose between:- Class Updating edges by class.
- Cluster Updating edges by cluster, using
CLUSTERprefix. - Record ID Updating edges by Record ID.
SETUpdates the field to the given value.INCREMENTIncrements the given field by the value.ADDDefines an item to add to a collection of fields.REMOVEDefines an item to remove from a collection of fields.PUTDefines an entry to put into a map field.RETURNDefines the expression you want to return after running the update.COUNTReturns the number of updated records. This is the default operator.BEFOREReturns the records before the update.AFTERReturns the records after the update.
WHEREDefines the filter conditions.LOCKDefines how the record locks between the load and update. You can choose between the following lock strategies:DEFAULTDisables locking. Use this in the event of concurrent updates. It throws an exception in the event of conflict.RECORDLocks the record during the update.
LIMITDefines the maximum number of records to update.
Examples
Change the edge endpoint:
orientdb>UPDATE EDGE Friend SET out = (SELECT FROM Person WHERE name = 'John') WHERE foo = 'bar'
For more information, see