问题
I freshly installed ArangoDB 3.0.2 via Homebrew
When I ran a query following this link https://docs.arangodb.com/3.0/cookbook/Graph/FindingLeafNodesAql.html#using-the-visitor-from-an-aql-query
This error occurred:
Query: usage of unknown function 'TRAVERSAL()' (while parsing)
Could somebody please explain why I got this error? Thank you very much in advance.
FYI: I did run that query successfully in ArangoDB 2.8.
回答1:
All graph-related functions were removed from AQL in 3.0.
The faster and more flexible AQL graph traversal can be used instead.
There are migration recipes available, see e.g. https://docs.arangodb.com/3.0/cookbook/AQL/MigratingEdgeFunctionsTo3.html
Not all cookbook recipes are up-to-date, the one you tried was written for 2.x and does not work anymore in 3.x. @dothebart just removed the obsolete graph recipes from the cookbook, they will be gone after the next build to stop confusing users.
The following query should give you the same result for the example data (all leaf nodes = capitals only), but without the need for a user-defined AQL function:
FOR v IN 0..10 INBOUND "v/world" e
// leaf node = no inbound edges.
// We can use LIMIT 1 to optimize the traversal (we don't care how many edges)
FILTER LENGTH(FOR vv IN INBOUND v e LIMIT 1 RETURN 1) == 0
RETURN CONCAT(v.name, " (", v.type, ")")
来源:https://stackoverflow.com/questions/38436261/arangodb-3-0-usage-of-unknown-function-traversal-while-parsing