如何计算AQL的元素数量? [英] How to count number of elements with AQL?
本文介绍了如何计算AQL的元素数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要计算SQL查询结果中的元素:
db._query('FOR v in visitors FILTER v.ip ==127.0.0.1return COUNT(v .guid)')
I need to count elements that was in result of SQL query:
db._query('FOR v in visitors FILTER v.ip == "127.0.0.1" return COUNT(v.guid) ')
此请求返回我的每个GUID的长度,但我需要获取GUID的总数为例: 2。
This request is return my a length of every GUID, but I need to get total number of GUIDs for example: 2.
推荐答案
您需要使用查询结果作为 COUNT
函数,然后 RETURN
此结果。
You need to use the result of the query as input for the COUNT
function, and then RETURN
this result.
由于性能原因, 1
的实际查询的返回值:
You can replace the RETURN
value of the actual query by 1
for performance reasons:
RETURN COUNT(FOR v IN visitors FILTER v.ip == "127.0.0.1" RETURN 1)
这篇关于如何计算AQL的元素数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文