Hey,
you need to change your data model (or even split your single document into several documents, or use nested), if you want to aggregate by the name. The definitive guide has some nice chapters about data modeling (which also contains a chapter about nested document). Take your time and read the whole book if you can 
--Alex