- OrientDB Tutorial
- OrientDB - Home
- OrientDB - Overview
- OrientDB - Installation
- OrientDB - Basic Concepts
- OrientDB - Data Types
- OrientDB - Console Modes
- OrientDB Database Commands
- OrientDB - Create Database
- OrientDB - Alter Database
- OrientDB - Backup Database
- OrientDB - Restore Database
- OrientDB - Connect Database
- OrientDB - Disconnect Database
- OrientDB - Info Database
- OrientDB - List Database
- OrientDB - Freeze Database
- OrientDB - Release Database
- OrientDB - Config Database
- OrientDB - Export Database
- OrientDB - Import Database
- OrientDB - Commit Database
- OrientDB - Rollback Database
- OrientDB - Optimize Database
- OrientDB - Drop Database
- OrientDB Record Commands
- OrientDB - Insert Record
- OrientDB - Display Records
- OrientDB - Load Record
- OrientDB - Reload Record
- OrientDB - Export Record
- OrientDB - Update Record
- OrientDB - Truncate Record
- OrientDB - Delete Record
- OrientDB Class Commands
- OrientDB - Create Class
- OrientDB - Alter Class
- OrientDB - Truncate Class
- OrientDB - Drop Class
- OrientDB Cluster Commands
- OrientDB - Create Cluster
- OrientDB - Alter Cluster
- OrientDB - Truncate Cluster
- OrientDB - Drop Cluster
- OrientDB Property Commands
- OrientDB - Create Property
- OrientDB - Alter Property
- OrientDB - Drop Property
- OrientDB Vertex Commands
- OrientDB - Create Vertex
- OrientDB - Move Vertex
- OrientDB - Delete Vertex
- OrientDB Edge Commands
- OrientDB - Create Edge
- OrientDB - Update Edge
- OrientDB - Delete Edge
- OrientDB Advanced Concepts
- OrientDB - Functions
- OrientDB - Sequences
- OrientDB - Indexes
- OrientDB - Transactions
- OrientDB - Hooks
- OrientDB - Caching
- OrientDB - Logging
- OrientDB - Performance Tuning
- OrientDB - Upgrading
- OrientDB - Security
- OrientDB - Studio
- OrientDB Interfaces
- OrientDB - Java Interface
- OrientDB - Python Interface
- OrientDB Useful Resources
- OrientDB - Quick Guide
- OrientDB - Useful Resources
- OrientDB - Discussion
OrientDB - Update Edge
Update edge command is used to update edge records in the current database. This is equivalent to actual update command in addition to checking and maintaining graph consistency with vertices, in the event that you update the out and in properties.
The following statement is the basic syntax of Update Edge Command.
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>]
Following are the details about the options in the above syntax.
<edge> − Defines the edge that you want to update. You can choose between Class that updates edges by class, Cluster that updates edges by cluster, using CLUSTER prefix, or Record ID that updating edges by record ID.
SET − Updates the field to the given values.
INCREMENT − Increments the given field by the value.
ADD − Defines an item to add to a collection of fields.
REMOVE − Defines an item to remove from a collection of fields.
PUT − Defines an entry to put into map fields.
RETURN − Defines the expression you want to return after running the update.
WHERE − Defines the filter condition.
LOCK − Defines how the record locks between the load and updates.
LIMIT − Defines the maximum number of records.
Example
Let us consider an example of updating the edge named ‘address’ in the person class by taking data from the address table having area Id = 001, and the person name = Krishna.
orientdb> UPDATE EDGE address SET out = (SELECT FROM Address WHERE areaID = 001) WHERE name = 'krishna'
If the above query is executed successfully, you will get the following output.
Updated edge '[address[#10:3][#11:3->#14:2]]' in 0.012000 sec(s)