arangojs icon indicating copy to clipboard operation
arangojs copied to clipboard

graph.addEdgeDefinition fails to add with no error when using async.each

Open DamianCasale opened this issue 11 years ago • 3 comments

This could be an issue on arangos api side, however when using the arango web ui it is possible to add a graph with multiple "from" and "to" properties.

When attempting this via the node driver, there is no error thrown but any definitions which have more than one "from" property do not appear in the graph.

DamianCasale avatar Sep 16 '15 17:09 DamianCasale

Could you provide an example? You should be able to use multiple "from" properties by passing an array of values:

graph.addEdgeDefinition({
  collection: 'foo',
  from: ['a', 'b'],
  to: ['c', 'd']
});

Also note that there can be only one edge definition per edge collection even if the collection is used in multiple graphs: https://docs.arangodb.com/HttpGharial/Management.html

pluma avatar Sep 18 '15 16:09 pluma

It looks like the issue may not be related to multiple from properties and more related to the use of the async module adding multiple edge definitions to a single graph.

I have recently faced a similar issue with a single from edge and switching from async.each to async.eachSeries seems to make the the graph creation consistently add all edge definitions.

DamianCasale avatar Sep 30 '15 14:09 DamianCasale

The problem with async.each vs async.eachSeries is likely that each performs the queries in parallel whereas eachSeries performs them (as the name indicates) in series. Normally this shouldn't be a problem but if you can replicate this problem outside the JS driver (e.g. by simply using async.each with the raw HTTP API, such as using request) you should probably file an issue with ArangoDB itself.

pluma avatar Sep 30 '15 14:09 pluma