Database

[{"_id":"1","name":"recipe 1","comments":[{comment:"c1-1",rating:4},{comment:"c1-2",rating:3},{comment:"c1-3",rating:6}]},{"_id":"2","name":"recipe 2","comments":[{comment:"c2-1",rating:4},{comment:"c2-2",rating:5},{comment:"c2-3",rating:1},{comment:"c2-4",rating:2}]}]

Query

db.collection.aggregate([{$project:{_id:0,name:1,avgRating:{$avg:"$comments.rating"}}}])

Result