I have a records with links in document database:
MyRecord {
"@rid:": "#11:2"
...
links: ["#61:1", "#61:2", "#61:3"],
otherLink: "#62:1"
}
How to delete whole graph, knowing only top level #11:2
?
upd
So i want something like:
delete from ...#11:2...
that removes all records: #11:2, #61:1, #61:2, #61:3, #62:1
You could create a javascript function with one parameter (rid)
var o=orient.getDatabase();
var b=o.query("select *,links, otherLink from " + rid);
for(i=0;i<b.length;i++){
var links= b[i].field("links");
for(j=0;j<links.length;j++){
links[j].delete();
}
b[i].field("otherLink").delete();
b[i].delete();
}
and use this query
select nameFunction("your rid")
Hope it helps