SlideShare a Scribd company logo
1 of 6
Download to read offline
SS18CO018
EXPERIMENT NO. 05
AIM: Implementation of aggregate operation on document
THEORY:
Aggregation operations process data records and return computed results.
Aggregation operations group values from multiple documents together,
and can perform a variety of operations on the grouped data to return a
single result.
• MongoDB provides three ways to perform aggregation
1)the aggregation pipeline,
2) the map-reduce function,
3)single purpose aggregation methods.
• Aggregation Pipeline
Aggregations operations process data records and return computed results.
Aggregation operations group values from multiple documents together, and can
perform a variety of operations on the grouped data to return a single result. In SQL
count(*) and with group by is an equivalent of MongoDB aggregation.
The aggregate() Method
For the aggregation in MongoDB, you should use aggregate() method.
Syntax
Basic syntax of aggregate() method is as follows –
>db.COLLECTION_NAME.aggregate(AGGREGATE_OPERATION)
Following is a list of available aggregation expressions.
Expression Description
$sum Sums up the defined value from all
documents in the collection.
$avg Calculates the average of all given values
from all documents in the collection.
$min Gets the minimum of the corresponding
values from all documents in the
collection.
$max Gets the maximum of the corresponding
values from all documents in the
collection.
$push Inserts the value to an array in the
resulting document.
$addToSet Inserts the value to an array in the
resulting document but does not create
duplicates.
$first Gets the first document from the source
documents according to the grouping.
Typically this makes only sense together
with some previously applied
“$sort”-stage.
$last Gets the last document from the source
documents according to the grouping.
Typically this makes only sense together
with some previously applied
“$sort”-stage.
Following are the possible stages in aggregation framework −
$project − Used to select some specific fields from a collection.
$match − This is a filtering operation and thus this can reduce the amount of
documents that
are given as input to the next stage.
$group − This does the actual aggregation as discussed above.
$sort − Sorts the documents.
$skip − With this, it is possible to skip forward in the list of documents for a given
amount of documents.
$limit − This limits the amount of documents to look at, by the given number starting
from the current positions.
$unwind − This is used to unwind document that are using arrays. When using an
array, the data is kind of pre-joined and this operation will be undone with this to have
individual documents again. Thus with this stage we will increase the amount of
documents for the next stage.
For example:
In the example
Db.orders.aggregate(
[
{
$match: { status: “A” }
},
{
$group: { _id: “$cust_id”, total: { $sum: “$amount” } }
}
]
)
First Stage:
The $match stage filters the documents by the status field and passes to the next
stage those documents that have status equal to "A".
Second Stage:
The $group stage groups the documents by the cust_id field to calculate the sum
of the amount for each unique cust_id.The aggregation pipeline can use indexes to
improve its performance during some of its stages.
In addition, the aggregation pipeline has an internal optimization phase Aggregation
pipeline provides better performance and a more coherent interface than mapreduce.
,
2)Map – Reduce Function
MongoDB also provides map-reduce operations to perform aggregation. Map
reduce uses custom JavaScript functions to perform the map and reduce operations, as
well as the optional finalize operation.
Single Purpose Aggregation Operations
MongoDB Single Purpose Aggregation Operations
MongoDB also provides
1)db.collection.estimatedDocumentCount(),
2) db.collection.count()
3) db.collection.distinct().
All of these operations aggregate documents from a single collection. While these
operations provide simple access to common aggregation processes, they lack the
flexibility and capabilities of the aggregation pipeline and map-reduce.
CONCLUSION : Thus ,We have studied implementation of aggregate
operation on document.
OUTPUT
Create record of Employee for 10 people including field name, dept, post, year of
experience.
project fields name, dept & post
Update Experience of any one employee
Find out employees from computer department only
Find out the employees who are having experience above 10 years
Find out employees who are working in Civil department only.
Display seniority of employee from computer department.
From above collection show only 2 documents.

More Related Content

What's hot

Fosdem 2010 GT.M and OpenStreetMap
Fosdem 2010 GT.M and OpenStreetMapFosdem 2010 GT.M and OpenStreetMap
Fosdem 2010 GT.M and OpenStreetMapgeorge.james
 
CS 542 -- Query Optimization
CS 542 -- Query OptimizationCS 542 -- Query Optimization
CS 542 -- Query OptimizationJ Singh
 
Overview of query evaluation
Overview of query evaluationOverview of query evaluation
Overview of query evaluationavniS
 
Advance MapReduce Concepts - Module 4
Advance MapReduce Concepts - Module 4Advance MapReduce Concepts - Module 4
Advance MapReduce Concepts - Module 4Rohit Agrawal
 
Lost In The Clouds
Lost In The CloudsLost In The Clouds
Lost In The Cloudsgeorge.james
 
JavaScript own objects(Web Technology)
JavaScript own objects(Web Technology)JavaScript own objects(Web Technology)
JavaScript own objects(Web Technology)Dhananjaysinh Jhala
 
Dache: A Data Aware Caching for Big-Data using Map Reduce framework
Dache: A Data Aware Caching for Big-Data using Map Reduce frameworkDache: A Data Aware Caching for Big-Data using Map Reduce framework
Dache: A Data Aware Caching for Big-Data using Map Reduce frameworkSafir Shah
 
2016 foss4 g track: developing and implementing spatial etl processes with...
2016 foss4 g track:  developing and implementing  spatial etl processes  with...2016 foss4 g track:  developing and implementing  spatial etl processes  with...
2016 foss4 g track: developing and implementing spatial etl processes with...GIS in the Rockies
 
Database , 8 Query Optimization
Database , 8 Query OptimizationDatabase , 8 Query Optimization
Database , 8 Query OptimizationAli Usman
 
Analyzing Air Quality Measurements in Macedonia with Apache Drill
Analyzing Air Quality Measurements in Macedonia with Apache DrillAnalyzing Air Quality Measurements in Macedonia with Apache Drill
Analyzing Air Quality Measurements in Macedonia with Apache DrillMarjan Sterjev
 
Server side geo_tools_in_drupal_pnw_2012
Server side geo_tools_in_drupal_pnw_2012Server side geo_tools_in_drupal_pnw_2012
Server side geo_tools_in_drupal_pnw_2012Mack Hardy
 
Dache: A Data Aware Caching for Big-Data Applications Using the MapReduce Fra...
Dache: A Data Aware Caching for Big-Data Applications Usingthe MapReduce Fra...Dache: A Data Aware Caching for Big-Data Applications Usingthe MapReduce Fra...
Dache: A Data Aware Caching for Big-Data Applications Using the MapReduce Fra...Govt.Engineering college, Idukki
 
Air Pollution in Nova Scotia: Analysis and Predictions
Air Pollution in Nova Scotia: Analysis and PredictionsAir Pollution in Nova Scotia: Analysis and Predictions
Air Pollution in Nova Scotia: Analysis and PredictionsCarlo Carandang
 
Distributed Query Processing
Distributed Query ProcessingDistributed Query Processing
Distributed Query ProcessingMythili Kannan
 
Csc1100 lecture13 ch16_pt1
Csc1100 lecture13 ch16_pt1Csc1100 lecture13 ch16_pt1
Csc1100 lecture13 ch16_pt1IIUM
 
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston...
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston...Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston...
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston...Neo4j
 

What's hot (20)

Fosdem 2010 GT.M and OpenStreetMap
Fosdem 2010 GT.M and OpenStreetMapFosdem 2010 GT.M and OpenStreetMap
Fosdem 2010 GT.M and OpenStreetMap
 
CS 542 -- Query Optimization
CS 542 -- Query OptimizationCS 542 -- Query Optimization
CS 542 -- Query Optimization
 
Overview of query evaluation
Overview of query evaluationOverview of query evaluation
Overview of query evaluation
 
Advance MapReduce Concepts - Module 4
Advance MapReduce Concepts - Module 4Advance MapReduce Concepts - Module 4
Advance MapReduce Concepts - Module 4
 
Lost In The Clouds
Lost In The CloudsLost In The Clouds
Lost In The Clouds
 
CMPE275-Project1Report
CMPE275-Project1ReportCMPE275-Project1Report
CMPE275-Project1Report
 
M/DB and M/DB:X
M/DB and M/DB:XM/DB and M/DB:X
M/DB and M/DB:X
 
JavaScript own objects(Web Technology)
JavaScript own objects(Web Technology)JavaScript own objects(Web Technology)
JavaScript own objects(Web Technology)
 
Dache: A Data Aware Caching for Big-Data using Map Reduce framework
Dache: A Data Aware Caching for Big-Data using Map Reduce frameworkDache: A Data Aware Caching for Big-Data using Map Reduce framework
Dache: A Data Aware Caching for Big-Data using Map Reduce framework
 
2016 foss4 g track: developing and implementing spatial etl processes with...
2016 foss4 g track:  developing and implementing  spatial etl processes  with...2016 foss4 g track:  developing and implementing  spatial etl processes  with...
2016 foss4 g track: developing and implementing spatial etl processes with...
 
Database , 8 Query Optimization
Database , 8 Query OptimizationDatabase , 8 Query Optimization
Database , 8 Query Optimization
 
Analyzing Air Quality Measurements in Macedonia with Apache Drill
Analyzing Air Quality Measurements in Macedonia with Apache DrillAnalyzing Air Quality Measurements in Macedonia with Apache Drill
Analyzing Air Quality Measurements in Macedonia with Apache Drill
 
Entity framework
Entity frameworkEntity framework
Entity framework
 
Server side geo_tools_in_drupal_pnw_2012
Server side geo_tools_in_drupal_pnw_2012Server side geo_tools_in_drupal_pnw_2012
Server side geo_tools_in_drupal_pnw_2012
 
Dache: A Data Aware Caching for Big-Data Applications Using the MapReduce Fra...
Dache: A Data Aware Caching for Big-Data Applications Usingthe MapReduce Fra...Dache: A Data Aware Caching for Big-Data Applications Usingthe MapReduce Fra...
Dache: A Data Aware Caching for Big-Data Applications Using the MapReduce Fra...
 
Air Pollution in Nova Scotia: Analysis and Predictions
Air Pollution in Nova Scotia: Analysis and PredictionsAir Pollution in Nova Scotia: Analysis and Predictions
Air Pollution in Nova Scotia: Analysis and Predictions
 
Distributed Query Processing
Distributed Query ProcessingDistributed Query Processing
Distributed Query Processing
 
Csc1100 lecture13 ch16_pt1
Csc1100 lecture13 ch16_pt1Csc1100 lecture13 ch16_pt1
Csc1100 lecture13 ch16_pt1
 
Jiscad viz
Jiscad vizJiscad viz
Jiscad viz
 
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston...
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston...Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston...
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston...
 

Similar to Here are the steps to implement aggregate operations on the employee collection as per the given output:1. Insert 10 documents in the employee collection with fields - name, dept, post, experience.2. Aggregate on the employee collection and project only name, dept, post fields. 3. Update the experience field of one employee document.4. Match only documents where dept is "computer".5. Match documents where experience is greater than 10. 6. Match documents where dept is "Civil".7. Sort documents in descending order of experience from computer dept.8. Limit the output to 2 documents

Aggregation Framework in MongoDB Overview Part-1
Aggregation Framework in MongoDB Overview Part-1Aggregation Framework in MongoDB Overview Part-1
Aggregation Framework in MongoDB Overview Part-1Anuj Jain
 
MongoDB Aggregation MongoSF May 2011
MongoDB Aggregation MongoSF May 2011MongoDB Aggregation MongoSF May 2011
MongoDB Aggregation MongoSF May 2011Chris Westin
 
MongoDB - Aggregation Pipeline
MongoDB - Aggregation PipelineMongoDB - Aggregation Pipeline
MongoDB - Aggregation PipelineJason Terpko
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBRaghunath A
 
Introduction To MongoDB
Introduction To MongoDBIntroduction To MongoDB
Introduction To MongoDBElieHannouch
 
MongoDB Aggregation Framework
MongoDB Aggregation FrameworkMongoDB Aggregation Framework
MongoDB Aggregation FrameworkCaserta
 
SH 2 - SES 3 - MongoDB Aggregation Framework.pptx
SH 2 - SES 3 -  MongoDB Aggregation Framework.pptxSH 2 - SES 3 -  MongoDB Aggregation Framework.pptx
SH 2 - SES 3 - MongoDB Aggregation Framework.pptxMongoDB
 
K Means Clustering Algorithm for Partitioning Data Sets Evaluated From Horizo...
K Means Clustering Algorithm for Partitioning Data Sets Evaluated From Horizo...K Means Clustering Algorithm for Partitioning Data Sets Evaluated From Horizo...
K Means Clustering Algorithm for Partitioning Data Sets Evaluated From Horizo...IOSR Journals
 
MongoDB installation,CRUD operation & JavaScript shell
MongoDB installation,CRUD operation & JavaScript shellMongoDB installation,CRUD operation & JavaScript shell
MongoDB installation,CRUD operation & JavaScript shellShahDhruv21
 
Mongo Nosql CRUD Operations
Mongo Nosql CRUD OperationsMongo Nosql CRUD Operations
Mongo Nosql CRUD Operationsanujaggarwal49
 
IRJET- Review of Existing Methods in K-Means Clustering Algorithm
IRJET- Review of Existing Methods in K-Means Clustering AlgorithmIRJET- Review of Existing Methods in K-Means Clustering Algorithm
IRJET- Review of Existing Methods in K-Means Clustering AlgorithmIRJET Journal
 
Scaling PostgreSQL With GridSQL
Scaling PostgreSQL With GridSQLScaling PostgreSQL With GridSQL
Scaling PostgreSQL With GridSQLJim Mlodgenski
 
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introductiondinkar thakur
 
Comparison between cube techniques
Comparison between cube techniquesComparison between cube techniques
Comparison between cube techniquesijsrd.com
 
Precog & MongoDB User Group: Skyrocket Your Analytics
Precog & MongoDB User Group: Skyrocket Your Analytics Precog & MongoDB User Group: Skyrocket Your Analytics
Precog & MongoDB User Group: Skyrocket Your Analytics MongoDB
 
unit 4,Indexes in database.docx
unit 4,Indexes in database.docxunit 4,Indexes in database.docx
unit 4,Indexes in database.docxRaviRajput416403
 

Similar to Here are the steps to implement aggregate operations on the employee collection as per the given output:1. Insert 10 documents in the employee collection with fields - name, dept, post, experience.2. Aggregate on the employee collection and project only name, dept, post fields. 3. Update the experience field of one employee document.4. Match only documents where dept is "computer".5. Match documents where experience is greater than 10. 6. Match documents where dept is "Civil".7. Sort documents in descending order of experience from computer dept.8. Limit the output to 2 documents (20)

Aggregation Framework in MongoDB Overview Part-1
Aggregation Framework in MongoDB Overview Part-1Aggregation Framework in MongoDB Overview Part-1
Aggregation Framework in MongoDB Overview Part-1
 
MongoDB Aggregation MongoSF May 2011
MongoDB Aggregation MongoSF May 2011MongoDB Aggregation MongoSF May 2011
MongoDB Aggregation MongoSF May 2011
 
MongoDB - Aggregation Pipeline
MongoDB - Aggregation PipelineMongoDB - Aggregation Pipeline
MongoDB - Aggregation Pipeline
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Introduction To MongoDB
Introduction To MongoDBIntroduction To MongoDB
Introduction To MongoDB
 
MongoDB Aggregation Framework
MongoDB Aggregation FrameworkMongoDB Aggregation Framework
MongoDB Aggregation Framework
 
SH 2 - SES 3 - MongoDB Aggregation Framework.pptx
SH 2 - SES 3 -  MongoDB Aggregation Framework.pptxSH 2 - SES 3 -  MongoDB Aggregation Framework.pptx
SH 2 - SES 3 - MongoDB Aggregation Framework.pptx
 
fard car.pptx
fard car.pptxfard car.pptx
fard car.pptx
 
K Means Clustering Algorithm for Partitioning Data Sets Evaluated From Horizo...
K Means Clustering Algorithm for Partitioning Data Sets Evaluated From Horizo...K Means Clustering Algorithm for Partitioning Data Sets Evaluated From Horizo...
K Means Clustering Algorithm for Partitioning Data Sets Evaluated From Horizo...
 
MongoDB installation,CRUD operation & JavaScript shell
MongoDB installation,CRUD operation & JavaScript shellMongoDB installation,CRUD operation & JavaScript shell
MongoDB installation,CRUD operation & JavaScript shell
 
Mongo Nosql CRUD Operations
Mongo Nosql CRUD OperationsMongo Nosql CRUD Operations
Mongo Nosql CRUD Operations
 
IRJET- Review of Existing Methods in K-Means Clustering Algorithm
IRJET- Review of Existing Methods in K-Means Clustering AlgorithmIRJET- Review of Existing Methods in K-Means Clustering Algorithm
IRJET- Review of Existing Methods in K-Means Clustering Algorithm
 
MongoDB_ppt.pptx
MongoDB_ppt.pptxMongoDB_ppt.pptx
MongoDB_ppt.pptx
 
MongoDB-presentation.pptx
MongoDB-presentation.pptxMongoDB-presentation.pptx
MongoDB-presentation.pptx
 
Scaling PostgreSQL With GridSQL
Scaling PostgreSQL With GridSQLScaling PostgreSQL With GridSQL
Scaling PostgreSQL With GridSQL
 
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introduction
 
Comparison between cube techniques
Comparison between cube techniquesComparison between cube techniques
Comparison between cube techniques
 
Precog & MongoDB User Group: Skyrocket Your Analytics
Precog & MongoDB User Group: Skyrocket Your Analytics Precog & MongoDB User Group: Skyrocket Your Analytics
Precog & MongoDB User Group: Skyrocket Your Analytics
 
Mdb dn 2016_06_query_primer
Mdb dn 2016_06_query_primerMdb dn 2016_06_query_primer
Mdb dn 2016_06_query_primer
 
unit 4,Indexes in database.docx
unit 4,Indexes in database.docxunit 4,Indexes in database.docx
unit 4,Indexes in database.docx
 

More from Ankit Dubey

Unit 1 android and it's tools quiz {mad cwipedia}
Unit 1 android and it's tools quiz {mad cwipedia}Unit 1 android and it's tools quiz {mad cwipedia}
Unit 1 android and it's tools quiz {mad cwipedia}Ankit Dubey
 
Ch5 cpu-scheduling
Ch5 cpu-schedulingCh5 cpu-scheduling
Ch5 cpu-schedulingAnkit Dubey
 
Ch2 system structure
Ch2 system structureCh2 system structure
Ch2 system structureAnkit Dubey
 
Ch1 introduction-to-os
Ch1 introduction-to-osCh1 introduction-to-os
Ch1 introduction-to-osAnkit Dubey
 
Mongodb mock test_ii
Mongodb mock test_iiMongodb mock test_ii
Mongodb mock test_iiAnkit Dubey
 
Android mock test_iii
Android mock test_iiiAndroid mock test_iii
Android mock test_iiiAnkit Dubey
 
Android mock test_ii
Android mock test_iiAndroid mock test_ii
Android mock test_iiAnkit Dubey
 
Ajp notes-chapter-06
Ajp notes-chapter-06Ajp notes-chapter-06
Ajp notes-chapter-06Ankit Dubey
 
Ajp notes-chapter-05
Ajp notes-chapter-05Ajp notes-chapter-05
Ajp notes-chapter-05Ankit Dubey
 
Ajp notes-chapter-04
Ajp notes-chapter-04Ajp notes-chapter-04
Ajp notes-chapter-04Ankit Dubey
 
Ajp notes-chapter-03
Ajp notes-chapter-03Ajp notes-chapter-03
Ajp notes-chapter-03Ankit Dubey
 

More from Ankit Dubey (20)

Unit 1 android and it's tools quiz {mad cwipedia}
Unit 1 android and it's tools quiz {mad cwipedia}Unit 1 android and it's tools quiz {mad cwipedia}
Unit 1 android and it's tools quiz {mad cwipedia}
 
Scheduling
Scheduling Scheduling
Scheduling
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
Ch5 cpu-scheduling
Ch5 cpu-schedulingCh5 cpu-scheduling
Ch5 cpu-scheduling
 
Ch4 threads
Ch4 threadsCh4 threads
Ch4 threads
 
Ch3 processes
Ch3 processesCh3 processes
Ch3 processes
 
Ch2 system structure
Ch2 system structureCh2 system structure
Ch2 system structure
 
Ch1 introduction-to-os
Ch1 introduction-to-osCh1 introduction-to-os
Ch1 introduction-to-os
 
Android i
Android iAndroid i
Android i
 
Mongodb mock test_ii
Mongodb mock test_iiMongodb mock test_ii
Mongodb mock test_ii
 
Android mock test_iii
Android mock test_iiiAndroid mock test_iii
Android mock test_iii
 
Android mock test_ii
Android mock test_iiAndroid mock test_ii
Android mock test_ii
 
Ajp notes-chapter-06
Ajp notes-chapter-06Ajp notes-chapter-06
Ajp notes-chapter-06
 
Ajp notes-chapter-05
Ajp notes-chapter-05Ajp notes-chapter-05
Ajp notes-chapter-05
 
Ajp notes-chapter-04
Ajp notes-chapter-04Ajp notes-chapter-04
Ajp notes-chapter-04
 
Ajp notes-chapter-03
Ajp notes-chapter-03Ajp notes-chapter-03
Ajp notes-chapter-03
 

Recently uploaded

High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 

Recently uploaded (20)

Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 

Here are the steps to implement aggregate operations on the employee collection as per the given output:1. Insert 10 documents in the employee collection with fields - name, dept, post, experience.2. Aggregate on the employee collection and project only name, dept, post fields. 3. Update the experience field of one employee document.4. Match only documents where dept is "computer".5. Match documents where experience is greater than 10. 6. Match documents where dept is "Civil".7. Sort documents in descending order of experience from computer dept.8. Limit the output to 2 documents

  • 1. SS18CO018 EXPERIMENT NO. 05 AIM: Implementation of aggregate operation on document THEORY: Aggregation operations process data records and return computed results. Aggregation operations group values from multiple documents together, and can perform a variety of operations on the grouped data to return a single result. • MongoDB provides three ways to perform aggregation 1)the aggregation pipeline, 2) the map-reduce function, 3)single purpose aggregation methods. • Aggregation Pipeline Aggregations operations process data records and return computed results. Aggregation operations group values from multiple documents together, and can perform a variety of operations on the grouped data to return a single result. In SQL count(*) and with group by is an equivalent of MongoDB aggregation. The aggregate() Method For the aggregation in MongoDB, you should use aggregate() method. Syntax Basic syntax of aggregate() method is as follows – >db.COLLECTION_NAME.aggregate(AGGREGATE_OPERATION) Following is a list of available aggregation expressions. Expression Description $sum Sums up the defined value from all documents in the collection. $avg Calculates the average of all given values from all documents in the collection. $min Gets the minimum of the corresponding values from all documents in the collection. $max Gets the maximum of the corresponding values from all documents in the collection. $push Inserts the value to an array in the resulting document. $addToSet Inserts the value to an array in the
  • 2. resulting document but does not create duplicates. $first Gets the first document from the source documents according to the grouping. Typically this makes only sense together with some previously applied “$sort”-stage. $last Gets the last document from the source documents according to the grouping. Typically this makes only sense together with some previously applied “$sort”-stage. Following are the possible stages in aggregation framework − $project − Used to select some specific fields from a collection. $match − This is a filtering operation and thus this can reduce the amount of documents that are given as input to the next stage. $group − This does the actual aggregation as discussed above. $sort − Sorts the documents. $skip − With this, it is possible to skip forward in the list of documents for a given amount of documents. $limit − This limits the amount of documents to look at, by the given number starting from the current positions. $unwind − This is used to unwind document that are using arrays. When using an array, the data is kind of pre-joined and this operation will be undone with this to have individual documents again. Thus with this stage we will increase the amount of documents for the next stage. For example: In the example Db.orders.aggregate( [ { $match: { status: “A” } }, { $group: { _id: “$cust_id”, total: { $sum: “$amount” } } } ] ) First Stage: The $match stage filters the documents by the status field and passes to the next
  • 3. stage those documents that have status equal to "A". Second Stage: The $group stage groups the documents by the cust_id field to calculate the sum of the amount for each unique cust_id.The aggregation pipeline can use indexes to improve its performance during some of its stages. In addition, the aggregation pipeline has an internal optimization phase Aggregation pipeline provides better performance and a more coherent interface than mapreduce. , 2)Map – Reduce Function MongoDB also provides map-reduce operations to perform aggregation. Map reduce uses custom JavaScript functions to perform the map and reduce operations, as well as the optional finalize operation. Single Purpose Aggregation Operations MongoDB Single Purpose Aggregation Operations MongoDB also provides 1)db.collection.estimatedDocumentCount(), 2) db.collection.count() 3) db.collection.distinct(). All of these operations aggregate documents from a single collection. While these operations provide simple access to common aggregation processes, they lack the flexibility and capabilities of the aggregation pipeline and map-reduce. CONCLUSION : Thus ,We have studied implementation of aggregate operation on document.
  • 4. OUTPUT Create record of Employee for 10 people including field name, dept, post, year of experience.
  • 5. project fields name, dept & post Update Experience of any one employee Find out employees from computer department only Find out the employees who are having experience above 10 years
  • 6. Find out employees who are working in Civil department only. Display seniority of employee from computer department. From above collection show only 2 documents.