Skip to content

Commit a36f84a

Browse files
committed
Clarified traversal API.
1 parent 507ff39 commit a36f84a

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,7 +1541,7 @@ Performs a traversal starting from the given *startVertex* and following edges c
15411541

15421542
See [the HTTP API documentation](https://docs.arangodb.com/HttpTraversal/README.html) for details on the additional arguments.
15431543

1544-
Please note that while *opts.filter*, *opts.visitor*, *opts.init*, *opts.expander* and *opts.sort* should be strings evaluating to well-formed JavaScript functions, it's not possible to pass in JavaScript functions directly because the functions need to be evaluated on the server and will be transmitted in plain text.
1544+
Please note that while *opts.filter*, *opts.visitor*, *opts.init*, *opts.expander* and *opts.sort* should be strings evaluating to well-formed JavaScript code, it's not possible to pass in JavaScript functions directly because the code needs to be evaluated on the server and will be transmitted in plain text.
15451545

15461546
*Examples*
15471547

@@ -1558,15 +1558,12 @@ db.createEdgeCollection('my-edges', function (err, collection) {
15581558
], function (err) {
15591559
if (err) return console.error(err);
15601560
collection.traversal('vertices/a', {
1561-
visitor: String(function (config, result, vertex, path) {
1562-
result.vertices.push(vertex._key);
1563-
}),
1564-
init: String(function (config, result) {
1565-
result.vertices = [];
1566-
})
1561+
direction: 'outbound',
1562+
visitor: 'result.vertices.push(vertex._key);',
1563+
init: 'result.vertices = [];'
15671564
}, function (err, result) {
15681565
if (err) return console.error(err);
1569-
result.vertices; // ['a', 'b', 'c']
1566+
result.vertices; // ['a', 'b', 'c', 'd']
15701567
});
15711568
});
15721569
});

0 commit comments

Comments
 (0)