【发布时间】:2016-07-13 00:22:11
【问题描述】:
来自 neo4j,刚接触 Arango。
我正在尝试查询我的数据并构建相应的数据结构。
所以我有类似的东西:
Circle A
/ \
Square A Circle B
/ \ \
Circle C Square B Square D
圆存储在一个文档集合中。 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}]
}
*还要注意我不想嵌套这个结构。就像我想要 parents 中的 {data from Circle A} 一样 - 我不希望这也有父母、孩子、方块 - 只是从字面上寻找包含在该节点中的元数据。
我知道我可以这样开始……但我很快就迷路了。即使在做基础知识时 - 我似乎无法正确收集它并将数组与键相关联。
FOR c in Circle
FILTER c.name === 'Circle B'
FOR hc in HAS_CIRCLE
FILTER hc._from === c._id
【问题讨论】:
标签: javascript arangodb aql