Akanksha Chhattri

Jul 16, 2021

4 min read

Map Reduce in Mongo DB

Introduction to MongoDB

Introduction to MapReduce

Map-Reduce in MongoDB


Example Statement :

  1. Define the map function to process each input document:
  • Create Javascript function to maps the price to the order_date for each document
  • emits function help to take the output to the next function.
  • The value is an element of the price emitted by the map function and grouped by order_date.
  • The reduce function averages the elements of price.
  • mapFun and redFun are the mapper and reducer functions
  • query specifies the optional selection criteria for selecting documents
  • out specifies the location of the map-reduce query result.