MongoDB Map-reduce working-Programmershelper

Spread the love


In this article, we learn MongoDB Map-reduce detail.My main focus describes its simple steps.Map-reduce is a data processing paradigm for extracting large data into the useful aggregate function.the number of a company has the data center.problems are facing how to find data quickly as much as of the main and very famous models is Map-reduce.All the searching is done using map reduce.It is a way to computation. when data is processing in the different machine.Map-reduce is programming model.which consists of three stages.

  1. Map
  2. Shuffle
  3. reduce

how these are works I will explain the simple example.Take data on document and map into <node 1> and shuffle <node 2> and then combined data into a <final node>.same in below fig.Alt tag MongoDB Map-reduce


So it will be good for also read my previous articles.In which I explained.   Click here MongoDB aggregation working and MongoDB Drop a database and How can drop collection in MongoDB.

Implementation Section

Map_Reduce function



<Map>: Java script function maps a value with key and emits a key value pair result.

<Reduce>: Java script function reduces the document and returns the result in a single object.

<Out>: Result of operation.

<query> Selection of input document which data you selected from a document.

<Sort> Specific sorting criteria input document.

<Limit>: limit number document return.

<Scope>: Include the final information you access the function it is also optional.

<Verbose>: Include the timing information by default it’s true and optional.

  • So we will apply a map reduce function of the following document-

Practical working

MongoDB Map-Reduce

Map Reduce apply a large group of data using aggerate function and extract specific we apply a map reduce in collection<porgammershelpes> find following data status is<programmershelperMongoDB>.

The following syntax is used


MongoDB Map reduce


After this, we will use find method() to see the map reduce result.we apply a map reduce in collection<porgammershelpes> find data on the base of status is equal <programmershelperMongoDB>and calculated the order_total.above document<stu_id:125> of two time.

The following syntax is used


Alt tag Mongodb mapreduce

You saw above resutl <_id”abc124“> have <value :1030> and<_id”abc125“>have <value: 2071> because <stu_125>comes two times its first value 1035 and second value 1031 its gives result add these two. which equal to <2071>.


I wish I could tell you that a great site of just understands key element above post-MongoDB Map-reduce.You also read my previous lecture.I hope you will understand this lecture.Thank you for reading this lecture. Hope you got the idea. please share it.