简体   繁体   中英

ArangoDB 3.0: Usage of unknown function 'TRAVERSAL()' (while parsing)

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.

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 eg 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, ")")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM