SlideShare a Scribd company logo
Practical No:12
Problem Statement: Implement Mapreduce with suitable example using MongoDB.
> use prac12
switched to db prac12
> db.c1.insert({"post_text": "India is an awesome country","user_name":
... "sachin", "status":"active"})
WriteResult({ "nInserted" : 1 })
> db.c1.insert({"post_text": "welcome to India","user_name":
"saurav","status":"active"})
WriteResult({ "nInserted" : 1 })
> db.c1.insert({"post_text": "I live in India","user_name":
"yuvraj","status":"active"})
WriteResult({ "nInserted" : 1 })
> db.c1.insert({"post_text": "India is great","user_name":
"gautam","status":"active"})
WriteResult({ "nInserted" : 1 })
> db.c1.mapReduce(
... function() { emit(this.user_name,1); },
... function(key, values) {return Array.sum(values)}, {
... query:{status:"active"},
... out:"post_total"
... }
... )
{
"result" : "post_total",
"timeMillis" : 59,
"counts" : {
"input" : 4,
"emit" : 4,
"reduce" : 0,
"output" : 4
},
"ok" : 1
}
>
)
> db.c1.find().pretty();
{
"_id" : ObjectId("5d96eebda693e3d886aed428"),
"post_text" : "India is an awesome country",
"user_name" : "sachin",
"status" : "active"
}
{
"_id" : ObjectId("5d96eedfa693e3d886aed429"),
"post_text" : "welcome to India",
"user_name" : "saurav",
"status" : "active"
}
{
"_id" : ObjectId("5d96eef3a693e3d886aed42a"),
"post_text" : "I live in India",
"user_name" : "yuvraj",
"status" : "active"
}
{
"_id" : ObjectId("5d96ef08a693e3d886aed42b"),
"post_text" : "India is great",
"user_name" : "gautam",
"status" : "active"
}

More Related Content

What's hot (20)

Bootstrap
Bootstrap
NexThoughts Technologies
 
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston...
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston...
Neo4j
 
Do something useful in Apps Script 5. Get your analytics pageviews to a sprea...
Do something useful in Apps Script 5. Get your analytics pageviews to a sprea...
Bruce McPherson
 
NoSQL with MongoDB
NoSQL with MongoDB
Ikram Manseri
 
Google cloud datastore driver for Google Apps Script DB abstraction
Google cloud datastore driver for Google Apps Script DB abstraction
Bruce McPherson
 
Azure sql insert perf
Azure sql insert perf
Mornè Blake
 
Productive Programming in Groovy
Productive Programming in Groovy
Ganesh Samarthyam
 
Goa tutorial
Goa tutorial
Bruce McPherson
 
JavaScript client API for Google Apps Script API primer
JavaScript client API for Google Apps Script API primer
Bruce McPherson
 
Working with NoSQL in a SQL Database (XDevApi)
Working with NoSQL in a SQL Database (XDevApi)
Lior Altarescu
 
NoSQL in SQL - Lior Altarescu
NoSQL in SQL - Lior Altarescu
Wix Engineering
 
Do something in 5 with gas 4- Get your analytics profiles to a spreadsheet
Do something in 5 with gas 4- Get your analytics profiles to a spreadsheet
Bruce McPherson
 
Google App Engine Developer - Day4
Google App Engine Developer - Day4
Simon Su
 
Scalable network applications, event-driven - Node JS
Scalable network applications, event-driven - Node JS
Cosmin Mereuta
 
Mongo db updatedocumentusecases
Mongo db updatedocumentusecases
zarigatongy
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 Engine
Ricardo Silva
 
Dev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDB
MongoDB
 
Tricks
Tricks
MongoDB
 
Using Arbor/ RGraph JS libaries for Data Visualisation
Using Arbor/ RGraph JS libaries for Data Visualisation
Alex Hardman
 
Unit testing powershell
Unit testing powershell
Matt Wrock
 
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston...
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston...
Neo4j
 
Do something useful in Apps Script 5. Get your analytics pageviews to a sprea...
Do something useful in Apps Script 5. Get your analytics pageviews to a sprea...
Bruce McPherson
 
Google cloud datastore driver for Google Apps Script DB abstraction
Google cloud datastore driver for Google Apps Script DB abstraction
Bruce McPherson
 
Azure sql insert perf
Azure sql insert perf
Mornè Blake
 
Productive Programming in Groovy
Productive Programming in Groovy
Ganesh Samarthyam
 
JavaScript client API for Google Apps Script API primer
JavaScript client API for Google Apps Script API primer
Bruce McPherson
 
Working with NoSQL in a SQL Database (XDevApi)
Working with NoSQL in a SQL Database (XDevApi)
Lior Altarescu
 
NoSQL in SQL - Lior Altarescu
NoSQL in SQL - Lior Altarescu
Wix Engineering
 
Do something in 5 with gas 4- Get your analytics profiles to a spreadsheet
Do something in 5 with gas 4- Get your analytics profiles to a spreadsheet
Bruce McPherson
 
Google App Engine Developer - Day4
Google App Engine Developer - Day4
Simon Su
 
Scalable network applications, event-driven - Node JS
Scalable network applications, event-driven - Node JS
Cosmin Mereuta
 
Mongo db updatedocumentusecases
Mongo db updatedocumentusecases
zarigatongy
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 Engine
Ricardo Silva
 
Dev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDB
MongoDB
 
Using Arbor/ RGraph JS libaries for Data Visualisation
Using Arbor/ RGraph JS libaries for Data Visualisation
Alex Hardman
 
Unit testing powershell
Unit testing powershell
Matt Wrock
 

Similar to Implement Mapreduce with suitable example using MongoDB. (20)

MongoDB and hadoop
MongoDB and hadoop
Steven Francia
 
MongoDB, Hadoop and humongous data - MongoSV 2012
MongoDB, Hadoop and humongous data - MongoSV 2012
Steven Francia
 
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
MongoSF
 
Social Data and Log Analysis Using MongoDB
Social Data and Log Analysis Using MongoDB
Takahiro Inoue
 
MongoDB
MongoDB
Steve Klabnik
 
MongoDB, Hadoop and Humongous Data
MongoDB, Hadoop and Humongous Data
Steven Francia
 
Xxx treme aggregation
Xxx treme aggregation
Bill Slacum
 
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDB
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDB
Cody Ray
 
MongoDB - Introduction
MongoDB - Introduction
Vagmi Mudumbai
 
Introduction to MongoDB for C# developers
Introduction to MongoDB for C# developers
Taras Romanyk
 
Analytics with MongoDB Aggregation Framework and Hadoop Connector
Analytics with MongoDB Aggregation Framework and Hadoop Connector
Henrik Ingo
 
introtomongodb
introtomongodb
saikiran
 
Latinoware
Latinoware
kchodorow
 
Mongodb intro
Mongodb intro
christkv
 
Analytical data processing
Analytical data processing
Polad Saruxanov
 
Building Apps with MongoDB
Building Apps with MongoDB
Nate Abele
 
Introduction to MongoDB
Introduction to MongoDB
Raghunath A
 
MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)
Uwe Printz
 
Building Your First MongoDB App ~ Metadata Catalog
Building Your First MongoDB App ~ Metadata Catalog
hungarianhc
 
Advanced Analytics & Statistics with MongoDB
Advanced Analytics & Statistics with MongoDB
John De Goes
 
MongoDB, Hadoop and humongous data - MongoSV 2012
MongoDB, Hadoop and humongous data - MongoSV 2012
Steven Francia
 
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
MongoSF
 
Social Data and Log Analysis Using MongoDB
Social Data and Log Analysis Using MongoDB
Takahiro Inoue
 
MongoDB, Hadoop and Humongous Data
MongoDB, Hadoop and Humongous Data
Steven Francia
 
Xxx treme aggregation
Xxx treme aggregation
Bill Slacum
 
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDB
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDB
Cody Ray
 
MongoDB - Introduction
MongoDB - Introduction
Vagmi Mudumbai
 
Introduction to MongoDB for C# developers
Introduction to MongoDB for C# developers
Taras Romanyk
 
Analytics with MongoDB Aggregation Framework and Hadoop Connector
Analytics with MongoDB Aggregation Framework and Hadoop Connector
Henrik Ingo
 
introtomongodb
introtomongodb
saikiran
 
Mongodb intro
Mongodb intro
christkv
 
Analytical data processing
Analytical data processing
Polad Saruxanov
 
Building Apps with MongoDB
Building Apps with MongoDB
Nate Abele
 
Introduction to MongoDB
Introduction to MongoDB
Raghunath A
 
MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)
Uwe Printz
 
Building Your First MongoDB App ~ Metadata Catalog
Building Your First MongoDB App ~ Metadata Catalog
hungarianhc
 
Advanced Analytics & Statistics with MongoDB
Advanced Analytics & Statistics with MongoDB
John De Goes
 
Ad

More from bhavesh lande (20)

The Annual G20 Scorecard – Research Performance 2019
The Annual G20 Scorecard – Research Performance 2019
bhavesh lande
 
information control and Security system
information control and Security system
bhavesh lande
 
information technology and infrastructures choices
information technology and infrastructures choices
bhavesh lande
 
ethical issues,social issues
ethical issues,social issues
bhavesh lande
 
managing inforamation system
managing inforamation system
bhavesh lande
 
• E-commerce, e-business ,e-governance
• E-commerce, e-business ,e-governance
bhavesh lande
 
IT and innovations
IT and innovations
bhavesh lande
 
organisations and information systems
organisations and information systems
bhavesh lande
 
IT stratergy and digital goods
IT stratergy and digital goods
bhavesh lande
 
aggregation and indexing with suitable example using MongoDB.
aggregation and indexing with suitable example using MongoDB.
bhavesh lande
 
Unnamed PL/SQL code block: Use of Control structure and Exception handling i...
Unnamed PL/SQL code block: Use of Control structure and Exception handling i...
bhavesh lande
 
database application using SQL DML statements: all types of Join, Sub-Query ...
database application using SQL DML statements: all types of Join, Sub-Query ...
bhavesh lande
 
database application using SQL DML statements: Insert, Select, Update, Delet...
database application using SQL DML statements: Insert, Select, Update, Delet...
bhavesh lande
 
Design and Develop SQL DDL statements which demonstrate the use of SQL objec...
Design and Develop SQL DDL statements which demonstrate the use of SQL objec...
bhavesh lande
 
working with python
working with python
bhavesh lande
 
applications and advantages of python
applications and advantages of python
bhavesh lande
 
introduction of python in data science
introduction of python in data science
bhavesh lande
 
tools
tools
bhavesh lande
 
data scientists and their role
data scientists and their role
bhavesh lande
 
applications
applications
bhavesh lande
 
The Annual G20 Scorecard – Research Performance 2019
The Annual G20 Scorecard – Research Performance 2019
bhavesh lande
 
information control and Security system
information control and Security system
bhavesh lande
 
information technology and infrastructures choices
information technology and infrastructures choices
bhavesh lande
 
ethical issues,social issues
ethical issues,social issues
bhavesh lande
 
managing inforamation system
managing inforamation system
bhavesh lande
 
• E-commerce, e-business ,e-governance
• E-commerce, e-business ,e-governance
bhavesh lande
 
organisations and information systems
organisations and information systems
bhavesh lande
 
IT stratergy and digital goods
IT stratergy and digital goods
bhavesh lande
 
aggregation and indexing with suitable example using MongoDB.
aggregation and indexing with suitable example using MongoDB.
bhavesh lande
 
Unnamed PL/SQL code block: Use of Control structure and Exception handling i...
Unnamed PL/SQL code block: Use of Control structure and Exception handling i...
bhavesh lande
 
database application using SQL DML statements: all types of Join, Sub-Query ...
database application using SQL DML statements: all types of Join, Sub-Query ...
bhavesh lande
 
database application using SQL DML statements: Insert, Select, Update, Delet...
database application using SQL DML statements: Insert, Select, Update, Delet...
bhavesh lande
 
Design and Develop SQL DDL statements which demonstrate the use of SQL objec...
Design and Develop SQL DDL statements which demonstrate the use of SQL objec...
bhavesh lande
 
applications and advantages of python
applications and advantages of python
bhavesh lande
 
introduction of python in data science
introduction of python in data science
bhavesh lande
 
data scientists and their role
data scientists and their role
bhavesh lande
 
Ad

Recently uploaded (20)

A Comprehensive Investigation into the Accuracy of Soft Computing Tools for D...
A Comprehensive Investigation into the Accuracy of Soft Computing Tools for D...
Journal of Soft Computing in Civil Engineering
 
grade 9 science q1 quiz.pptx science quiz
grade 9 science q1 quiz.pptx science quiz
norfapangolima
 
Universal Human Values and professional ethics Quantum AKTU BVE401
Universal Human Values and professional ethics Quantum AKTU BVE401
Unknown
 
3. What is the principles of Teamwork_Module_V1.0.ppt
3. What is the principles of Teamwork_Module_V1.0.ppt
engaash9
 
operationg systemsdocumentmemorymanagement
operationg systemsdocumentmemorymanagement
SNIGDHAAPPANABHOTLA
 
Great power lithium iron phosphate cells
Great power lithium iron phosphate cells
salmankhan835951
 
chemistry investigatory project for class 12
chemistry investigatory project for class 12
Susis10
 
Structural Design for Residential-to-Restaurant Conversion
Structural Design for Residential-to-Restaurant Conversion
DanielRoman285499
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
djiceramil
 
TEA2016AAT 160 W TV application design example
TEA2016AAT 160 W TV application design example
ssuser1be9ce
 
Center Enamel can Provide Aluminum Dome Roofs for diesel tank.docx
Center Enamel can Provide Aluminum Dome Roofs for diesel tank.docx
CenterEnamel
 
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
kippcam
 
Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...
Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...
João Esperancinha
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
Water demand - Types , variations and WDS
Water demand - Types , variations and WDS
dhanashree78
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
djiceramil
 
Impurities of Water and their Significance.pptx
Impurities of Water and their Significance.pptx
dhanashree78
 
ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025
Rahul
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
Présentation_gestion[1] [Autosaved].pptx
Présentation_gestion[1] [Autosaved].pptx
KHADIJAESSAKET
 
grade 9 science q1 quiz.pptx science quiz
grade 9 science q1 quiz.pptx science quiz
norfapangolima
 
Universal Human Values and professional ethics Quantum AKTU BVE401
Universal Human Values and professional ethics Quantum AKTU BVE401
Unknown
 
3. What is the principles of Teamwork_Module_V1.0.ppt
3. What is the principles of Teamwork_Module_V1.0.ppt
engaash9
 
operationg systemsdocumentmemorymanagement
operationg systemsdocumentmemorymanagement
SNIGDHAAPPANABHOTLA
 
Great power lithium iron phosphate cells
Great power lithium iron phosphate cells
salmankhan835951
 
chemistry investigatory project for class 12
chemistry investigatory project for class 12
Susis10
 
Structural Design for Residential-to-Restaurant Conversion
Structural Design for Residential-to-Restaurant Conversion
DanielRoman285499
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-ABB Furse.pdf
djiceramil
 
TEA2016AAT 160 W TV application design example
TEA2016AAT 160 W TV application design example
ssuser1be9ce
 
Center Enamel can Provide Aluminum Dome Roofs for diesel tank.docx
Center Enamel can Provide Aluminum Dome Roofs for diesel tank.docx
CenterEnamel
 
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
kippcam
 
Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...
Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...
João Esperancinha
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
Water demand - Types , variations and WDS
Water demand - Types , variations and WDS
dhanashree78
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
djiceramil
 
Impurities of Water and their Significance.pptx
Impurities of Water and their Significance.pptx
dhanashree78
 
ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025
Rahul
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
Présentation_gestion[1] [Autosaved].pptx
Présentation_gestion[1] [Autosaved].pptx
KHADIJAESSAKET
 

Implement Mapreduce with suitable example using MongoDB.

  • 1. Practical No:12 Problem Statement: Implement Mapreduce with suitable example using MongoDB. > use prac12 switched to db prac12 > db.c1.insert({"post_text": "India is an awesome country","user_name": ... "sachin", "status":"active"}) WriteResult({ "nInserted" : 1 }) > db.c1.insert({"post_text": "welcome to India","user_name": "saurav","status":"active"}) WriteResult({ "nInserted" : 1 }) > db.c1.insert({"post_text": "I live in India","user_name": "yuvraj","status":"active"}) WriteResult({ "nInserted" : 1 }) > db.c1.insert({"post_text": "India is great","user_name": "gautam","status":"active"}) WriteResult({ "nInserted" : 1 }) > db.c1.mapReduce( ... function() { emit(this.user_name,1); }, ... function(key, values) {return Array.sum(values)}, { ... query:{status:"active"}, ... out:"post_total" ... } ... ) { "result" : "post_total", "timeMillis" : 59, "counts" : { "input" : 4, "emit" : 4, "reduce" : 0, "output" : 4 }, "ok" : 1 } > ) > db.c1.find().pretty(); { "_id" : ObjectId("5d96eebda693e3d886aed428"), "post_text" : "India is an awesome country", "user_name" : "sachin", "status" : "active" } { "_id" : ObjectId("5d96eedfa693e3d886aed429"), "post_text" : "welcome to India", "user_name" : "saurav", "status" : "active" } { "_id" : ObjectId("5d96eef3a693e3d886aed42a"), "post_text" : "I live in India", "user_name" : "yuvraj", "status" : "active" } { "_id" : ObjectId("5d96ef08a693e3d886aed42b"), "post_text" : "India is great",