我有一个 AQL 查询遍历图,它始终应从一组唯一的集合中返回固定数量的文档。
因此每个集合只会发生一次并且仅包含一个文档。
我希望将它们全部合并到反映文档集合名称的属性下的单个文档中。
查询很简单:
FOR v IN ANY "vertex/key" edge_collection RETURN v
返回示例结果为:
[
{
"_key": "123",
"_id": "foo/123",
"_rev": "_WYhh0ji---",
"foo_attribute": "lorem impsum"
},
{
"_key": "456",
"_id": "bar/456",
"_rev": "_WYhh2ny---",
"bar_attribute": "dolor sit amet"
}
]
我希望得到这样的:
[
{
"foo": {
"_key": "123",
"_id": "foo/123",
"_rev": "_WYhh0ji---",
"foo_attribute": "lorem impsum"
},
"bar": {
"_key": "456",
"_id": "calendar/bar",
"_rev": "_WYhh2ny---",
"bar_attribute": "dolor sit amet"
}
}
]