O'Reilly logo

Practical Data Analysis by Hector Cuesta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using MapReduce with MongoDB

MongoDB provides us with a mapReduce command and in the following figure, we can observe the life circle of the MapReduce process in MongoDB. We start with a Collection or a query and each document in the collection will call the map function. Then, using the emit function we will create an intermediate hash map (See the following figure) with a list of pairs (key-value). Next, the reduce function will iterate the intermediate hash map and it will apply some operation to all values of each key. Finally, the process will create a brand new collection with the output. The map/reduce functions in MongoDB will be programmed with JavaScript.

Tip

You can find the reference documentation of MapReduce with MongoDB at http://docs.mongodb.org/manual/core/map-reduce/ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required