返す代わりに、とサブ属性p.path
の ID を収集し、それらを 2 つの別々の配列で返すことができます。vertices
edges
LET from = (FOR u IN products FILTER u.name == 'foo' RETURN u._id)
FOR p IN TRAVERSAL(products, productsrelated, from[0], 'outbound', {
minDepth: 0,
maxDepth: 3,
paths: true
})
RETURN {
vertices: p.path.vertices[*]._id,
edges: p.path.edges[*]._id
}
次のような構造を返します。
[
{
"vertices": [
"products/..."
],
"edges": []
},
{
"vertices": [
"products/...",
"products/..."
],
"edges": [
"productsrelated/..."
]
},
...
{
"vertices": [
"products/...",
"products/...",
"products/..."
],
"edges": [
"productsrelated/...",
"productsrelated/..."
]
}
]