【发布时间】:2023-03-08 23:05:01
【问题描述】:
想象一下我有一个这样的边缘文档:
[{
"_from": "mobiles/12345",
"_to": "mobiles/54321",
"type": "call",
},
{
"_from": "mobiles/54321",
"_to": "mobiles/32145",
"type": "sms",
},
{
"_from": "mobiles/54321",
"_to": "mobiles/12345",
"type": "call",
}]
在 54321 上查询时我需要得到这样的列表:
{"54321":3, "12345":2,"32145":1}
我试过了,但这不是我想要的:
for v,e,p in any "mobiles/54321" docs
COLLECT from = e._from , to = e._to with count into len
return {from, to, len}
我在 Elasticsearch 中使用 aggs 查询很容易做到这一点
【问题讨论】:
-
你也标记了python3.x,原生python3解决方案也可以吗?
-
我的意思是 AQL 答案,感谢@CodeManX 我明白了,但谢谢
标签: python python-3.x arangodb pyarango