Get the Code Here :
Best MongoDB Book :

I received a bunch of questions about using Map Reduce in MongoDB, so here I provide a bunch of examples. First I’ll cover Map Reduce using straight JavaScript. Then we’ll cover increasingly complex MongoDB Map Reduce queries. Then finally I’ll cover using Group and Distinct.