来自 neo4j 和 Arango 的新手。
我正在尝试查询我的数据并构建相应的数据结构。
所以我有类似的东西:
Circle A
/ \
Square A Circle B
/ \ \
Circle C Square B Square D
Circle 存储在一个文档集合中。Square 存储在一个文档集合中。
然后我有两个适当对应的边缘集合 HAS_CIRCLE 和 HAS_SQUARE。
我知道我想要 Circle B 和它的邻居——在这样的结构中。
{
circle: {data from Circle B},
parents: [{data from Circle A}],
children: [{data from Circle C}],
squares: [{data from Square B}, {data from Square D}]
}
*还要注意我不想嵌套这个结构。就像我想要 {data from Circle A} in parents
- 我不希望这也有父母,孩子,广场 - 只是在寻找包含在该节点中的元数据。
我知道我可以这样开始……但我很快就迷路了。即使在做基础知识时 - 我似乎无法正确收集它并将数组与键相关联。
FOR c in Circle
FILTER c.name === 'Circle B'
FOR hc in HAS_CIRCLE
FILTER hc._from === c._id