I have a graph like this:
// [user] -answer-> [question]
for u in user
filter u._id in ['user/foo', 'user/bar']
for v, e in 1 outbound u graph 'qaGraph'
return keep(e, '_from', '_to', 'chosen')
Output:
[
{
"_from": "user/foo",
"_to": "question/A",
"chosen": 0
},
{
"_from": "user/foo",
"_to": "question/B",
"chosen": 0
},
{
"_from": "user/foo",
"_to": "question/C",
"chosen": 1
},
{
"_from": "user/bar",
"_to": "question/A",
"chosen": 0
},
{
"_from": "user/bar",
"_to": "question/C",
"chosen": 0
}
]
That means foo and bar have answered two questions in common (A & C) but they gave the same answer to only one question (A).
How can I write an AQL to return the same information in the following format?
{
"questions": 2,
"match": 1
}
I'm struggling here but without success, so any help would be appreciated.
Thanks!
- Edit: I forgot to mention that all questions are multiple choice, with only two alternatives: 0 or 1. So
answer.chosen
represent the user's choice.