Map-Reduce Using MongoDB

What is MongoDB?




What is the aggression framework?


Step 1: Installing MongoDB

Step 2: Installing MongoDB tools

Step 3: Setting up environment variables path for using MongoDB server and database tools from CLI.

Step 4: Using map-reduce function in MongoDB
  1. Persons
  2. Deck Of Cards

Example 1: Persons

>>mongoimport persons.json -d Persons -c peoples --jsonArray
DB & Collection Created
Aggregation Pipeline
>>var mapFunc2=function(){var peeps=emit(this.gender,this.age);$split:[peeps,”,”];};
var reduceFunc2=function(keyGender,valuesAge){return valuesAge.length;};
Map-Reduce Program

Example 2: Deck Of Cards

Deck Of Cards
>>mongoimport cards.json -d deck_of_cards -c cards--jsonArray
Data Imported in DB
Aggregation Pipeline



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store