Database
[{"name":"Medical Visit Survey","question":["Ease of making an appointment?","About how long was your wait time before being seen by the provider?","Professionalism of person who took your call?"],"type":["radiobutton","radiobutton","radiobutton"],"answers":["Excellent","Less than 20 minutes","Excellent"]},{"name":"Medical Visit Survey","question":["Ease of making an appointment?","About how long was your wait time before being seen by the provider?","Professionalism of person who took your call?"],"type":["radiobutton","radiobutton","radiobutton"],"answers":["Excellent","Less than 20 minutes","Very Good"]}]
Query
db.collection.aggregate([{$unwind:{path:"$question",includeArrayIndex:"index"}},{$group:{_id:{question:"$question",answer:{$arrayElemAt:["$answers","$index"]}},name:{$first:"$name"},type:{$first:{$arrayElemAt:["$type","$index"]}},count:{$sum:1}}},{$group:{_id:"$_id.question",answers:{$push:{k:"$_id.answer",v:"$count"}},name:{$first:"$name"},type:{$first:"$type"}}},{$addFields:{answers:{$arrayToObject:"$answers"}}}])