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

PPTX
Asynchronous programming
Filip Ekberg
 
PPTX
No More Deadlocks; Asynchronous Programming in .NET
Filip Ekberg
 
PPTX
利用Init connect做mysql clients stat 用户审计
Dehua Yang
 
DOC
How to speedup GWT compiler
Mohammed Kharma
 
PPTX
Google apps script database abstraction exposed version
Bruce McPherson
 
PDF
Do something in 5 with gas 3-simple invoicing app
Bruce McPherson
 
KEY
Polyglot parallelism
Phillip Toland
 
PPTX
Dbabstraction
Bruce McPherson
 
Asynchronous programming
Filip Ekberg
 
No More Deadlocks; Asynchronous Programming in .NET
Filip Ekberg
 
利用Init connect做mysql clients stat 用户审计
Dehua Yang
 
How to speedup GWT compiler
Mohammed Kharma
 
Google apps script database abstraction exposed version
Bruce McPherson
 
Do something in 5 with gas 3-simple invoicing app
Bruce McPherson
 
Polyglot parallelism
Phillip Toland
 
Dbabstraction
Bruce McPherson
 

What's hot (20)

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

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

PDF
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
STX Next
 
PDF
Kotlin Developer Starter in Android projects
Bartosz Kosarzycki
 
PDF
Embedding a language into string interpolator
Michael Limansky
 
PDF
Mongoskin - Guilin
Jackson Tian
 
PDF
Selectors and normalizing state shape
Muntasir Chowdhury
 
PDF
Hadoop Integration in Cassandra
Jairam Chandar
 
PDF
Redux "Bad" Practices - A List of 13 Bad Practices and How to Avoid Them
Adam Klein
 
PPT
Spring data iii
명철 강
 
ODP
A Year With MongoDB: The Tips
Rizky Abdilah
 
PDF
compose_speaker_session.pdf
AnkurAgarwal151093
 
PDF
Spray Json and MongoDB Queries: Insights and Simple Tricks.
Andrii Lashchenko
 
PDF
Herding types with Scala macros
Marina Sigaeva
 
PDF
Intro to Redux | DreamLab Academy #3
DreamLab
 
PDF
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
MongoSF
 
KEY
Scala on Your Phone
Michael Galpin
 
PPTX
React/Redux
Durgesh Vaishnav
 
PPTX
Query for json databases
Binh Le
 
DOCX
Intro to Java Programming 10th ed- Implement the inorder- preorder- po.docx
olsenlinnea427
 
PDF
Introduction to Scalding and Monoids
Hugo Gävert
 
PDF
React 101
Casear Chu
 
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
STX Next
 
Kotlin Developer Starter in Android projects
Bartosz Kosarzycki
 
Embedding a language into string interpolator
Michael Limansky
 
Mongoskin - Guilin
Jackson Tian
 
Selectors and normalizing state shape
Muntasir Chowdhury
 
Hadoop Integration in Cassandra
Jairam Chandar
 
Redux "Bad" Practices - A List of 13 Bad Practices and How to Avoid Them
Adam Klein
 
Spring data iii
명철 강
 
A Year With MongoDB: The Tips
Rizky Abdilah
 
compose_speaker_session.pdf
AnkurAgarwal151093
 
Spray Json and MongoDB Queries: Insights and Simple Tricks.
Andrii Lashchenko
 
Herding types with Scala macros
Marina Sigaeva
 
Intro to Redux | DreamLab Academy #3
DreamLab
 
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
MongoSF
 
Scala on Your Phone
Michael Galpin
 
React/Redux
Durgesh Vaishnav
 
Query for json databases
Binh Le
 
Intro to Java Programming 10th ed- Implement the inorder- preorder- po.docx
olsenlinnea427
 
Introduction to Scalding and Monoids
Hugo Gävert
 
React 101
Casear Chu
 
Ad

More from bhavesh lande (20)

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

Recently uploaded (20)

PDF
The Effect of Artifact Removal from EEG Signals on the Detection of Epileptic...
Partho Prosad
 
PDF
Software Testing Tools - names and explanation
shruti533256
 
PDF
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
PPTX
database slide on modern techniques for optimizing database queries.pptx
aky52024
 
PPT
1. SYSTEMS, ROLES, AND DEVELOPMENT METHODOLOGIES.ppt
zilow058
 
PPTX
Victory Precisions_Supplier Profile.pptx
victoryprecisions199
 
PPTX
Introduction of deep learning in cse.pptx
fizarcse
 
PPTX
Chapter_Seven_Construction_Reliability_Elective_III_Msc CM
SubashKumarBhattarai
 
PPTX
Color Model in Textile ( RGB, CMYK).pptx
auladhossain191
 
PDF
Traditional Exams vs Continuous Assessment in Boarding Schools.pdf
The Asian School
 
PPTX
MSME 4.0 Template idea hackathon pdf to understand
alaudeenaarish
 
PPTX
easa module 3 funtamental electronics.pptx
tryanothert7
 
PDF
Packaging Tips for Stainless Steel Tubes and Pipes
heavymetalsandtubes
 
PPTX
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
PPTX
22PCOAM21 Session 1 Data Management.pptx
Guru Nanak Technical Institutions
 
PPTX
IoT_Smart_Agriculture_Presentations.pptx
poojakumari696707
 
PDF
dse_final_merit_2025_26 gtgfffffcjjjuuyy
rushabhjain127
 
PDF
Cryptography and Information :Security Fundamentals
Dr. Madhuri Jawale
 
PDF
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
PDF
Zero Carbon Building Performance standard
BassemOsman1
 
The Effect of Artifact Removal from EEG Signals on the Detection of Epileptic...
Partho Prosad
 
Software Testing Tools - names and explanation
shruti533256
 
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
database slide on modern techniques for optimizing database queries.pptx
aky52024
 
1. SYSTEMS, ROLES, AND DEVELOPMENT METHODOLOGIES.ppt
zilow058
 
Victory Precisions_Supplier Profile.pptx
victoryprecisions199
 
Introduction of deep learning in cse.pptx
fizarcse
 
Chapter_Seven_Construction_Reliability_Elective_III_Msc CM
SubashKumarBhattarai
 
Color Model in Textile ( RGB, CMYK).pptx
auladhossain191
 
Traditional Exams vs Continuous Assessment in Boarding Schools.pdf
The Asian School
 
MSME 4.0 Template idea hackathon pdf to understand
alaudeenaarish
 
easa module 3 funtamental electronics.pptx
tryanothert7
 
Packaging Tips for Stainless Steel Tubes and Pipes
heavymetalsandtubes
 
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
22PCOAM21 Session 1 Data Management.pptx
Guru Nanak Technical Institutions
 
IoT_Smart_Agriculture_Presentations.pptx
poojakumari696707
 
dse_final_merit_2025_26 gtgfffffcjjjuuyy
rushabhjain127
 
Cryptography and Information :Security Fundamentals
Dr. Madhuri Jawale
 
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
Zero Carbon Building Performance standard
BassemOsman1
 

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",