Database
[{projects:[{_id:1,comments:["a","b","c"]},{_id:2,comments:["a","b"]},{_id:3,comments:[]}]}]
Query
db.collection.aggregate([{"$unwind":"$projects"},{$group:{_id:null,"projects":{$push:{_id:"$projects._id",comment_count:{$size:"$projects.comments"}}}}},{"$project":{"_id":0}}])