更新时间:2023-02-04 16:56:09
此答案由Zachary Zolton在沙发上的邮件列表中提供:
This answer was provided by Zachary Zolton on the couchdb mailing list:
开始您已经有了一个视图,可以为您提供鲍里斯(Boris)的5万首独特的
歌曲,您可以使用_list函数返回行数。
Since you've already got a view that'll give you Boris's 50k unique songs, you could use a _list function to return the number of rows.
像这样应该可以解决问题:
Something like this should do the trick:
function() {
var count = 0;
while(getRow()) count++;
return JSON.stringify({count: count});
}
如果使用相同的视图,键范围和$查询此列表函数b $ b组级别,它将仅使用一些JSON进行响应,例如: { count: 50612}
If you query this list function, with the same view, key range and
group level, it'll just respond with a bit of JSON, such as: {"count":"50612"}
您可以在此处阅读更多内容:
You can read up more here: