2
votes

I'm using the arangodb go client and trying to delete a vertex and have the dangling edges automatically removed.

The arangodb documentation says about named graphs :

The underlying collections of the named graphs are still accessible using the standard methods for collections. However the graph module adds an additional layer on top of these collections giving you the following guarantees: (...) If you delete a vertex all edges referring to this vertex will be deleted too

How do I harness the guarantees of the graph module using GO?

I created a named graph with the collections and edge collections that I want to delete from, and still if I just remove from the collection I get dangling edges pointing to the newly removed vertex.

Is there a way to use AQL to do this? The documentation suggests otherwise:

Deleting vertices with associated edges is currently not handled via AQL while the graph management interface and the REST API for the graph module offer a vertex deletion functionality.

Instead it offers a more complex query to do the same. But since this functionality exists on the graph web interface, and supposedly in the REST API, shouldn't it be present on the arangodb go driver? Am I missing something?

It seems the advantages/guarantees of using named graphs aren't really there.

1
Do you use graph.VertexCollection and VertexCollection.removeDocument, or just plain Collection? The former should work, the latter not. (not a go programmer, hard for me to parse the libs code)Tom Regner
@TomRegner Thank you, it does work! I discarded that idea without testing it since the function "VertexCollection" returns a Collection, just as the normal "Collection" function, but it seems arango internally distinguishes between both types. Thanks again.tiagosilva

1 Answers

0
votes

As @TomRegner suggested accessing a collection through graph.VertexCollection works.