Database

[{_id:"Vanilla Sundae",keywords:["vanilla","ice cream","desert"]},{_id:"Vanilla Cake",keywords:["vanilla","cake","baking","desert"]},{_id:"Chocolate Cake",keywords:["chocolate","cake","baking","desert"]}]

Query

db.collection.aggregate([{$unwind:"$keywords"},{$group:{_id:"$keywords",count:{$sum:1}}}])

Result