SlideShare a Scribd company logo
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.
MongoDB_ppt.pptx
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

More Related Content

PPTX
MongoDB is a document database. It stores data in a type of JSON format calle...
PDF
MongoDB.pdf
PPTX
How to learn MongoDB for beginner's
PDF
2016 feb-23 pyugre-py_mongo
PDF
Using MongoDB and Python
PPTX
Introduction to MongoDB
PPTX
Introduction to MongoDB – A NoSQL Database
PPTX
Introduction To MongoDB
MongoDB is a document database. It stores data in a type of JSON format calle...
MongoDB.pdf
How to learn MongoDB for beginner's
2016 feb-23 pyugre-py_mongo
Using MongoDB and Python
Introduction to MongoDB
Introduction to MongoDB – A NoSQL Database
Introduction To MongoDB

Similar to MongoDB_ppt.pptx (20)

PDF
MongoDB for Coder Training (Coding Serbia 2013)
PPT
MongoDB Pros and Cons
PPTX
MongoDB Knowledge share
PDF
MongoDB FabLab León
PPT
MongoDB
PDF
Quick overview on mongo db
PPT
9. Document Oriented Databases
PPTX
DBVersity MongoDB Online Training Presentations
PPTX
introtomongodb
PPTX
mongo.pptx
PPT
Mongo db basics
PPTX
ODP
MongoDB - A Document NoSQL Database
PPTX
MongoDB 3.0
PPT
Mongo Bb - NoSQL tutorial
PPT
Introduction to MongoDB
PPTX
MongoDB introduction features -presentation - 2.pptx
PDF
Mongodb
PPT
Introduction to Mongodb
PDF
full stack modul 5, mongodb,webpack,front-end,back-end
MongoDB for Coder Training (Coding Serbia 2013)
MongoDB Pros and Cons
MongoDB Knowledge share
MongoDB FabLab León
MongoDB
Quick overview on mongo db
9. Document Oriented Databases
DBVersity MongoDB Online Training Presentations
introtomongodb
mongo.pptx
Mongo db basics
MongoDB - A Document NoSQL Database
MongoDB 3.0
Mongo Bb - NoSQL tutorial
Introduction to MongoDB
MongoDB introduction features -presentation - 2.pptx
Mongodb
Introduction to Mongodb
full stack modul 5, mongodb,webpack,front-end,back-end
Ad

Recently uploaded (20)

PPTX
OOP with Java - Java Introduction (Basics)
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
Well-logging-methods_new................
PPTX
web development for engineering and engineering
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
Foundation to blockchain - A guide to Blockchain Tech
DOCX
573137875-Attendance-Management-System-original
PPT
Project quality management in manufacturing
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
Sustainable Sites - Green Building Construction
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
Strings in CPP - Strings in C++ are sequences of characters used to store and...
PPTX
Geodesy 1.pptx...............................................
PPTX
Welding lecture in detail for understanding
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
OOP with Java - Java Introduction (Basics)
Internet of Things (IOT) - A guide to understanding
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Well-logging-methods_new................
web development for engineering and engineering
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Foundation to blockchain - A guide to Blockchain Tech
573137875-Attendance-Management-System-original
Project quality management in manufacturing
CH1 Production IntroductoryConcepts.pptx
Sustainable Sites - Green Building Construction
CYBER-CRIMES AND SECURITY A guide to understanding
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Strings in CPP - Strings in C++ are sequences of characters used to store and...
Geodesy 1.pptx...............................................
Welding lecture in detail for understanding
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Ad

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.
  • 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