for $answer in collection("answers")
let $qid := $answer.question_id
group by $qid
let $count := count($answer)
where $count gt 1
let $count := sum(
collection("faqs")
[ $$.question_id eq $qid ]!size($$.tags)
)
return {
"question" : collection("faqs")
[$$.question_id eq $qid].title,
"count" : $count
}
Results:
{
"question" : "Find CouchDB docs missing an arbitrary fiel
d",
"count" : 4
}
{
"question" : "MySQL and NoSQL: Help me to choose the righ
t one",
"count" : 4
}
{
"question" : null,
"count" : 0
}