SlideShare una empresa de Scribd logo
1 de 20
MongoDB
{
By:
[
“Shirish Kulkarni”,
“Sagar Pol”
]
}
Why MongoDB?
• MongoDB is a NoSQL (Not only SQL) database that stores large volumes of data
in the form of documents.
• MongoDB removes the concept of "rows" of conventional and relational data
models by introducing “documents”.
• MongoDB is more flexible and ensures high and diverse data availability.
When to use MongoDB?
• You have lots of unstructured data. MongoDB (and NoSQL databases in general)
has no storable data type limits.
• You have schema issues. If you have an unstable or undefined schema, use
MongoDB.
Features of MongoDB
• Document-Oriented storage
• Full Index Support
• Replication & High Availability
• Auto-Sharding
• Querying
Scalable
Document-oriented storage:
• MongoDB is a document-oriented NoSQL database. It is used for storing
massive volumes of data. Unlike a traditional SQL relational database,
MongoDB does not rely on tables and columns. Data is stored as collections
and documents.
• Data is stored in BSON format internally and over the network but retrieved
as JSON.
• Index is a way to organize information so that the database engine can quickly
find the relevant results.
• Indexes in MongoDB are similar to indexes in other database systems. MongoDB
defines indexes at the collection level and supports indexes on any field or sub-
field of the documents in a MongoDB collection.
Full-index support:
• Replication is performed in MongoDB to maintain data redundancy and high
availability. It is performed by creating multiple copies of your data across
multiple servers.
Replication and high availability:
• Sharding is a method for distributing or partitioning data across multiple
machines.
• It is useful when no single machine can handle large modern-day workloads, by
allowing you to scale horizontally.
Auto-Sharding:
Querying:
• MongoDB Query is a way to get the data from the MongoDB database.
• MongoDB queries provide the simplicity in process of fetching data from the
database.
• MongoDB provides the function names as db.collection_name.find() to operate
query operation on database.
• Database: Newspaper
• Collection: Article
• Query: db.article.find() // returns all the documents in the Article collection
MongoDB Cluster, Database,
Collections
Comparison of MongoDB with RDBMS
RDBMS MongoDB
Database Database
Table, View Collection
Row Document (JSON, BSON)
Column Field
Index Index
Join Embedded Document
Foreign Key Reference
Example of Document
> db.user.findOne({age:39})
{
"_id" : ObjectId("5114e0bd42…"),
"first" : "John",
"last" : "Doe",
"age" : 39,
"interests" : [
"Reading",
"Mountain Biking ]
"favorites": {
"color": "Blue",
"sport": "Soccer"}
}
CRUD Operations
• Create
• db.collection.insert( <document> )
• db.collection.save( <document> )
• db.collection.update( <query>, <update>, { upsert:
true } )
• Read
• db.collection.find( <query>, <projection> )
• db.collection.findOne( <query>, <projection> )
• Update
• db.collection.update( <query>, <update>, <options> )
• Delete
• db.collection.remove( <query>, <justOne> )
CRUD Operations Example
> db.user.insert({
first: "John",
last : "Doe",
age: 39
})
> db.user.findOne(
{
"_id" : ObjectId("51…"),
})
> db.user.update(
{"_id" : ObjectId("51…")},
{
$set: {
age: 40,
salary: 7000}
}
)
> db.user.deleteOne({
“_id”: ObjectId(“6382er...”)
})
Aggregation Functions
• Aggregation operations process the data records/documents and return computed
results.
• It collects values from various documents and groups them together and then
performs different types of operations on that grouped data like sum, average,
minimum, maximum, etc to return a computed result.
• the aggregation pipeline consists of stages and each stage transforms the
document.
Aggregation Syntax
Basic syntax of aggregate() method is as follows −
 db.COLLECTION_NAME.aggregate(AGGREGATE_OPERATION)
 Example:
db.collection.aggregate([ {stage1}, {stage2}, {stage3}...])
• There is a set of possible stages and each of those is taken as a set of documents
as an input and produces a resulting set of documents (or the final resulting JSON
document at the end of the pipeline)
Stages
Stages: Each stage starts from stage operators which are:
•$match: It is used for filtering the documents can reduce the amount of documents
that are given as input to the next stage.
•$project: It is used to select some specific fields from a collection.
•$sort: It is used to sort the document that is rearranging them
•$limit: It is used to pass first n number of documents thus limiting them
CRUD Operations Demo
THANK YOU

Más contenido relacionado

Similar a MongoDB_ppt.pptx

3-Mongodb and Mapreduce Programming.pdf
3-Mongodb and Mapreduce Programming.pdf3-Mongodb and Mapreduce Programming.pdf
3-Mongodb and Mapreduce Programming.pdf
MarianJRuben
 
Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)
Kai Zhao
 

Similar a MongoDB_ppt.pptx (20)

3-Mongodb and Mapreduce Programming.pdf
3-Mongodb and Mapreduce Programming.pdf3-Mongodb and Mapreduce Programming.pdf
3-Mongodb and Mapreduce Programming.pdf
 
MongoDB
MongoDBMongoDB
MongoDB
 
MongoDB
MongoDBMongoDB
MongoDB
 
Mondodb
MondodbMondodb
Mondodb
 
Introduction To MongoDB
Introduction To MongoDBIntroduction To MongoDB
Introduction To MongoDB
 
Dev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDBDev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDB
 
2016 feb-23 pyugre-py_mongo
2016 feb-23 pyugre-py_mongo2016 feb-23 pyugre-py_mongo
2016 feb-23 pyugre-py_mongo
 
Using MongoDB and Python
Using MongoDB and PythonUsing MongoDB and Python
Using MongoDB and Python
 
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introduction
 
Introduction to MongoDB and its best practices
Introduction to MongoDB and its best practicesIntroduction to MongoDB and its best practices
Introduction to MongoDB and its best practices
 
UNIT-1 MongoDB.pptx
UNIT-1 MongoDB.pptxUNIT-1 MongoDB.pptx
UNIT-1 MongoDB.pptx
 
MongoDB
MongoDBMongoDB
MongoDB
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB
 
Mongo db nosql (1)
Mongo db nosql (1)Mongo db nosql (1)
Mongo db nosql (1)
 
MongoDB - A next-generation database that lets you create applications never ...
MongoDB - A next-generation database that lets you create applications never ...MongoDB - A next-generation database that lets you create applications never ...
MongoDB - A next-generation database that lets you create applications never ...
 
Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)
 
Mongodb
MongodbMongodb
Mongodb
 
Mongo db basics
Mongo db basicsMongo db basics
Mongo db basics
 
Dev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDBDev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDB
 
Top MongoDB interview Questions and Answers
Top MongoDB interview Questions and AnswersTop MongoDB interview Questions and Answers
Top MongoDB interview Questions and Answers
 

Último

notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
Health
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
MayuraD1
 

Último (20)

data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Air Compressor reciprocating single stage
Air Compressor reciprocating single stageAir Compressor reciprocating single stage
Air Compressor reciprocating single stage
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic Marks
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 

MongoDB_ppt.pptx

  • 2. Why MongoDB? • MongoDB is a NoSQL (Not only SQL) database that stores large volumes of data in the form of documents. • MongoDB removes the concept of "rows" of conventional and relational data models by introducing “documents”. • MongoDB is more flexible and ensures high and diverse data availability.
  • 3. When to use MongoDB? • You have lots of unstructured data. MongoDB (and NoSQL databases in general) has no storable data type limits. • You have schema issues. If you have an unstable or undefined schema, use MongoDB.
  • 4. Features of MongoDB • Document-Oriented storage • Full Index Support • Replication & High Availability • Auto-Sharding • Querying Scalable
  • 5. Document-oriented storage: • MongoDB is a document-oriented NoSQL database. It is used for storing massive volumes of data. Unlike a traditional SQL relational database, MongoDB does not rely on tables and columns. Data is stored as collections and documents. • Data is stored in BSON format internally and over the network but retrieved as JSON.
  • 6. • Index is a way to organize information so that the database engine can quickly find the relevant results. • Indexes in MongoDB are similar to indexes in other database systems. MongoDB defines indexes at the collection level and supports indexes on any field or sub- field of the documents in a MongoDB collection. Full-index support:
  • 7. • Replication is performed in MongoDB to maintain data redundancy and high availability. It is performed by creating multiple copies of your data across multiple servers. Replication and high availability:
  • 8. • Sharding is a method for distributing or partitioning data across multiple machines. • It is useful when no single machine can handle large modern-day workloads, by allowing you to scale horizontally. Auto-Sharding:
  • 9. Querying: • MongoDB Query is a way to get the data from the MongoDB database. • MongoDB queries provide the simplicity in process of fetching data from the database. • MongoDB provides the function names as db.collection_name.find() to operate query operation on database. • Database: Newspaper • Collection: Article • Query: db.article.find() // returns all the documents in the Article collection
  • 11. Comparison of MongoDB with RDBMS RDBMS MongoDB Database Database Table, View Collection Row Document (JSON, BSON) Column Field Index Index Join Embedded Document Foreign Key Reference
  • 12. Example of Document > db.user.findOne({age:39}) { "_id" : ObjectId("5114e0bd42…"), "first" : "John", "last" : "Doe", "age" : 39, "interests" : [ "Reading", "Mountain Biking ] "favorites": { "color": "Blue", "sport": "Soccer"} }
  • 13. CRUD Operations • Create • db.collection.insert( <document> ) • db.collection.save( <document> ) • db.collection.update( <query>, <update>, { upsert: true } ) • Read • db.collection.find( <query>, <projection> ) • db.collection.findOne( <query>, <projection> ) • Update • db.collection.update( <query>, <update>, <options> ) • Delete • db.collection.remove( <query>, <justOne> )
  • 14. CRUD Operations Example > db.user.insert({ first: "John", last : "Doe", age: 39 }) > db.user.findOne( { "_id" : ObjectId("51…"), }) > db.user.update( {"_id" : ObjectId("51…")}, { $set: { age: 40, salary: 7000} } ) > db.user.deleteOne({ “_id”: ObjectId(“6382er...”) })
  • 15. Aggregation Functions • Aggregation operations process the data records/documents and return computed results. • It collects values from various documents and groups them together and then performs different types of operations on that grouped data like sum, average, minimum, maximum, etc to return a computed result. • the aggregation pipeline consists of stages and each stage transforms the document.
  • 16.
  • 17. Aggregation Syntax Basic syntax of aggregate() method is as follows −  db.COLLECTION_NAME.aggregate(AGGREGATE_OPERATION)  Example: db.collection.aggregate([ {stage1}, {stage2}, {stage3}...]) • There is a set of possible stages and each of those is taken as a set of documents as an input and produces a resulting set of documents (or the final resulting JSON document at the end of the pipeline)
  • 18. Stages Stages: Each stage starts from stage operators which are: •$match: It is used for filtering the documents can reduce the amount of documents that are given as input to the next stage. •$project: It is used to select some specific fields from a collection. •$sort: It is used to sort the document that is rearranging them •$limit: It is used to pass first n number of documents thus limiting them