What is MapReduce?
Map-reduce is a data processing paradigm for condensing large volumes of data into useful aggregated results.
MapReduce is a popular big data term in recent years proposed by Google. It is a method for manipulate large data sets parallelly and distributedly on many machines. In my words, I usually said that Map-Reduce, “Map” is to assign match function to many machines for cutting a huge data into small data sets(group matched data), and then use “Reduce” to aggregate these calculated data.
In this map-reduce operation, MongoDB applies the map phase to each input document (i.e. the documents in the collection that match the query condition). The map function emits key-value pairs. For those keys that have multiple values, MongoDB applies the reduce phase, which collects and condenses the aggregated data. MongoDB then stores the results in a collection. Optionally, the output of the reduce function may pass through a finalize function to further condense or process the results of the aggregation.
if you want more details, please check official documents
Let’s go check how to use map reduce in Mongoid.
Read on →