Delete by reverse edge

I have a horrible feeling that I know the answer to this question, but is it possible to delete an edge from the reverse end? Something like this (in JSON):

{
  "delete": [
    {
      "uid": "0x2a", 
      "~edge": null
    }
  ]
}

Or do I have to go to the “originator” node and delete the edge specifically to this node? It would be wonderful if I could just delete using the “~” link identifier, but when I do it the edge is not removed. Am I doing something wrong?

To delete a Reverse Edge, you need to perform the deletion on the relationship source. And not at Child. However, both nodes will continue to exist - Because you are eliminating the Edge and not the node itself. By deleting Parent with *, you will get the desired result.

There is no deletion via “~ edge” - And if you delete only Edge, both nodes will persist.

The process would be as follows:

1 - Collect the UIDs found in the “~ edge” with a query.
2 - In a single batch execute the deletion of those Parent UIDs collected.

Yes I want both nodes to continue existing.

it just would be really nice if I could perform mutations from either end. I guess I could follow each reverse edge to the paired UID and perform the edge deletion from each of those. Deletion is always a pain in dgraph it seems…

Hm, there are three problems in this case.

The first is that these tasks based on reverse or similar would be very expensive. It would have some impact on performance.

The second point is that it is somewhat dangerous to do automated deletions. There are several deletion situations that are out of control. So it is better for the user to decide what to do.

The last is that the deletion would have to execute a query internally to collect the reverse UIDs. Technically they are two distinct procedures and there is no such support in Dgraph - which merges both.

Sure, it’s possible, but it needs to be evaluated. If you are interested please fill out an Issue in Github following the logic of experience report.

Cheers.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.