The delete() clause is used to delete nodes or edges that meet the given conditions. It's important to note that deleting a node leads to the removal of all edges that are connected to it.
The delete operation is irreversible.
Syntax// Delete nodes delete().nodes(<filter>).limit(<N>) // Delete edges delete().edges(<filter>).limit(<N>)
nodes() or edges() method. Leave it blank to specify all nodes or edges.limit() method to restrict the number of nodes or edges to delete.
Run these UQLs row by row in an empty graphset to create this graph:
UQLcreate().node_schema("user").edge_schema("follow") create().node_property(@user, "name").node_property(@user, "age", int32).edge_property(@follow, "time", datetime)Click to expand
UQLdelete().nodes({name == "Grace"})
The node with _id U003 is deleted, along with the edge with _uuid 2.
UQLdelete().edges({@follow})
All @follow edges are deleted.
UQLdelete().nodes({@user.age > 26}).limit(2)
This deletes the @user nodes whose age property values are greater than 26, limited to two nodes.