Database

[{"_id":1,c:[{d:[{b:[{a:1},{a:2},{a:2},{a:2}]}]}]}]

Query

db.collection.aggregate([])/*** count() how many are the "c.d.b.a":2 in the collection* Final result: {"a":3}*/

Result