SlideShare a Scribd company logo
MongoDB
1
Database Evolution
Flat Files RDBMS NoSQL MongoDB
1970s: data stored in flat
file system
1979: a standard
way of query the
data - what do we
want to query,
how to process
that query but
1998:
1. Key-value Store
2. Tabular
3. Document oriented
(MongoDB, CouchDB,
etc.)
2009: Free & Open
Source, Cross-
Platform, Document
Oriented
Problem:
no standard
implementation
Problem: with the
big n huge amount
data
Problem: Less support
for Complex Queries
Solution: Relational
Database
Solution: NoSQL Solution: Use Third-
Party GUIs
2
1. RDBMS’s do not well-scaling with very large size of data
2. RDBMS’s do not scale well to massive transaction rates
3. RDBMS’s cannot handle semi-structured data
4. RDBMS’s cannot handle unstructured data
5. RDBMS’s do not play well in a cloud environment
6. RDBMS’s cannot cope with changing or fuzzy schema specifications
and it is costly/impossible/slow to manage schema change
7. RDBMS’s cannot deal well with non-standard data like time series,
geospatial, or graph related data
3
NoSQL is a good solution to deal with these problems.
The problems with Relational Database:
What is NoSQL:
 NoSQL = Non SQL or Not only SQL
 Wikipedia’s definition:
4
A NoSQL database provides a mechanism for storage and retrieval of data
that is modeled in means other than the tabular relations used in relational
databases.
NoSQL Family 5
Knee Curve 6
What is MongoDB?
 Defination: MongoDB is an open source, document-
oriented database designed with both scalability and developer
agility in mind.
 Instead of storing your data in tables and rows as you would with
a relational database, in MongoDB you store JSON-like
documents(generally BSON) with dynamic schemas
(schema-free, schemaless).
7
Features
• Scalable High-Performance Open-source, Document-orientated
database.
• Built for Speed
• Rich Document based queries for Easy readability.
• Full Index Support for High Performance.
• Replication and Failover for High Availability.
• Auto Sharding for Easy Scalability.
• Map / Reduce for Aggregation.
8
WHAT IS MONGODB GREAT FOR?
• RDBMS replacement for Web Applications.
• Semi-structured Content Management.
• Real-time Analytics & High-Speed Logging.
• Caching and High Scalability
9
NOT GREAT FOR?
 Highly Transactional Applications.
 Problems requiring SQL.
 No referential integrity
 High degree of denormalization means updating
something in many places instead of one
10
Comparisons
RDBMS MongoDB
Relational database Document-oriented database, non relational
Schema based database, follow joins Schema-less database, references and
$lookup
Data stored in tables (tables contain
collection of rows)
Data stored in form of collection (collection
contain group of object document)
No horizontal scaling
Eg. 1st row has 5 column then 2nd row must
have 5 column for the given table
Horizontal scaling
Eg. 1st row has 5 column then 2nd row can
have any no of column for the given table
11
Data Format
JSON XML
{"employees“ :[
{"firstName":“Anju",
"lastName":“Shah"},
{"firstName":“Sumit Kumar",
"lastName":“Shah"},
{"firstName":“Shiva K.",
"lastName":“Shrestha"}
]}
<employees>
<employee>
<firstName>Anju</firstName>
<lastName>Shah</lastName>
</employee>
<employee>
<firstName>Sumit Kumar</firstName>
<lastName>Shah</lastName>
</employee>
<employee> <firstName>Shiva
K.</firstName>
<lastName>Shrestha</lastName>
</employee>
</employees>
12
Terminology Translation 13
SQL Terms/Concepts MongoDB Terms/Concepts
database database
table collection
row document
column field
index index
table joins (e.g. select queries) embedded documents and linking
Primary keys _id field is always the primary key
Aggregation (e.g. group by) aggregation pipeline
MongoDB Data Model 14
A collection includes documents.
MongoDB Data Model 15
Structure of a JSON-document:
The value of field:
 Native data types
 Arrays
 Other documents
MongoDB Data Model 16
Embedded documents:
The primary key
Installation
• Download and install suitable package for each platform [Windows, Linux,
Mac OSX, Solaris]
• Create a folder e.g. C:mongodb
• Go to bin of installation folder.
• Type following command: mongod --dbpath=C:/mongodb
• Run another command: mongo.exe
• The mongodb server is running.
17
CRUD
 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> )
18
CRUD example
> db.user.insert({
first: "John",
last : "Doe",
age: 39
})
> db.user.find ()
{
"_id" : ObjectId("51…"),
"first" : "John",
"last" : "Doe",
"age" : 39
}
> db.user.update(
{"_id" : ObjectId("51…")},
{
$set: {
age: 40,
salary: 7000}
}
)
> db.user.remove({
"first": /^J/
})
19
Conclusions
 MongoDB is fast
 Very little CPU overhead
 Implemented in C++ for best performance
 Free & Open Source, Cross-Platform, Document Oriented
 Easier and faster integration of data
 useful when working with a huge quantity of data when the data's
nature does not require a relational model
 used when what really matters is the ability to store and retrieve great
quantities of data, not the relationships between the elements.
 Works on many platforms and there are many language drivers
20
Thank You!
21

More Related Content

PDF
Mongo db basics
KEY
Mongodb intro
PPTX
PPTX
MongoDB: An Introduction - june-2011
PPTX
CSCi226PPT1
PPTX
Mongo db
PPTX
Mongo db basics
Mongodb intro
MongoDB: An Introduction - june-2011
CSCi226PPT1
Mongo db

What's hot (20)

PPTX
Mongo db intro.pptx
PPT
MongoDb - Details on the POC
PPTX
Mongo db
PPTX
Mango Database - Web Development
PPTX
MongoDB
PPTX
MongoDB presentation
KEY
MongoDB NYC Python
DOCX
MongoDB DOC v1.5
PPTX
Mongo db workshop # 01
PDF
Introduction to mongo db by zain
PDF
Mongo db onepage
PPT
performance analysis between sql ans nosql
DOCX
Mongo db report
PPTX
Back to Basics 2017 - Introduction to NoSQL
PPTX
Get expertise with mongo db
PDF
Open source Technology
ODP
Redis IU
PPTX
Mongo db
PPTX
Introduction to MongoDB and CRUD operations
PPTX
MongoDB for Beginners
Mongo db intro.pptx
MongoDb - Details on the POC
Mongo db
Mango Database - Web Development
MongoDB
MongoDB presentation
MongoDB NYC Python
MongoDB DOC v1.5
Mongo db workshop # 01
Introduction to mongo db by zain
Mongo db onepage
performance analysis between sql ans nosql
Mongo db report
Back to Basics 2017 - Introduction to NoSQL
Get expertise with mongo db
Open source Technology
Redis IU
Mongo db
Introduction to MongoDB and CRUD operations
MongoDB for Beginners
Ad

Similar to Mongo db (20)

PPTX
PDF
3-Mongodb and Mapreduce Programming.pdf
PDF
A Study on Mongodb Database
PDF
A Study on Mongodb Database.pdf
PPTX
Nosql
PPTX
Mongodb Introduction
PPTX
PPTX
Mongo db
PPTX
05201349_Unit_7_FSWD_ advanced learning.pptx
PPTX
05201349_Unit_7_FSWD_II(1) with advance.pptx
PPTX
Mongodb - NoSql Database
PPTX
MongoDB
PPT
Mongo Bb - NoSQL tutorial
PPTX
mongodb introduction11111111111111111111
PPTX
MongoDB
PDF
Introduction to MongoDB Basics from SQL to NoSQL
PPTX
MongoDB 2.4 and spring data
PDF
Mongo db dhruba
PPTX
NOSQL and MongoDB Database
3-Mongodb and Mapreduce Programming.pdf
A Study on Mongodb Database
A Study on Mongodb Database.pdf
Nosql
Mongodb Introduction
Mongo db
05201349_Unit_7_FSWD_ advanced learning.pptx
05201349_Unit_7_FSWD_II(1) with advance.pptx
Mongodb - NoSql Database
MongoDB
Mongo Bb - NoSQL tutorial
mongodb introduction11111111111111111111
MongoDB
Introduction to MongoDB Basics from SQL to NoSQL
MongoDB 2.4 and spring data
Mongo db dhruba
NOSQL and MongoDB Database
Ad

Recently uploaded (20)

PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
PPT on Performance Review to get promotions
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
Sustainable Sites - Green Building Construction
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
Construction Project Organization Group 2.pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPT
Mechanical Engineering MATERIALS Selection
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
UNIT 4 Total Quality Management .pptx
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
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
Welding lecture in detail for understanding
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPT
Project quality management in manufacturing
PPTX
Foundation to blockchain - A guide to Blockchain Tech
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPT on Performance Review to get promotions
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Operating System & Kernel Study Guide-1 - converted.pdf
Sustainable Sites - Green Building Construction
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
bas. eng. economics group 4 presentation 1.pptx
Construction Project Organization Group 2.pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Mechanical Engineering MATERIALS Selection
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
UNIT 4 Total Quality Management .pptx
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
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...
Welding lecture in detail for understanding
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Project quality management in manufacturing
Foundation to blockchain - A guide to Blockchain Tech

Mongo db

  • 2. Database Evolution Flat Files RDBMS NoSQL MongoDB 1970s: data stored in flat file system 1979: a standard way of query the data - what do we want to query, how to process that query but 1998: 1. Key-value Store 2. Tabular 3. Document oriented (MongoDB, CouchDB, etc.) 2009: Free & Open Source, Cross- Platform, Document Oriented Problem: no standard implementation Problem: with the big n huge amount data Problem: Less support for Complex Queries Solution: Relational Database Solution: NoSQL Solution: Use Third- Party GUIs 2
  • 3. 1. RDBMS’s do not well-scaling with very large size of data 2. RDBMS’s do not scale well to massive transaction rates 3. RDBMS’s cannot handle semi-structured data 4. RDBMS’s cannot handle unstructured data 5. RDBMS’s do not play well in a cloud environment 6. RDBMS’s cannot cope with changing or fuzzy schema specifications and it is costly/impossible/slow to manage schema change 7. RDBMS’s cannot deal well with non-standard data like time series, geospatial, or graph related data 3 NoSQL is a good solution to deal with these problems. The problems with Relational Database:
  • 4. What is NoSQL:  NoSQL = Non SQL or Not only SQL  Wikipedia’s definition: 4 A NoSQL database provides a mechanism for storage and retrieval of data that is modeled in means other than the tabular relations used in relational databases.
  • 7. What is MongoDB?  Defination: MongoDB is an open source, document- oriented database designed with both scalability and developer agility in mind.  Instead of storing your data in tables and rows as you would with a relational database, in MongoDB you store JSON-like documents(generally BSON) with dynamic schemas (schema-free, schemaless). 7
  • 8. Features • Scalable High-Performance Open-source, Document-orientated database. • Built for Speed • Rich Document based queries for Easy readability. • Full Index Support for High Performance. • Replication and Failover for High Availability. • Auto Sharding for Easy Scalability. • Map / Reduce for Aggregation. 8
  • 9. WHAT IS MONGODB GREAT FOR? • RDBMS replacement for Web Applications. • Semi-structured Content Management. • Real-time Analytics & High-Speed Logging. • Caching and High Scalability 9
  • 10. NOT GREAT FOR?  Highly Transactional Applications.  Problems requiring SQL.  No referential integrity  High degree of denormalization means updating something in many places instead of one 10
  • 11. Comparisons RDBMS MongoDB Relational database Document-oriented database, non relational Schema based database, follow joins Schema-less database, references and $lookup Data stored in tables (tables contain collection of rows) Data stored in form of collection (collection contain group of object document) No horizontal scaling Eg. 1st row has 5 column then 2nd row must have 5 column for the given table Horizontal scaling Eg. 1st row has 5 column then 2nd row can have any no of column for the given table 11
  • 12. Data Format JSON XML {"employees“ :[ {"firstName":“Anju", "lastName":“Shah"}, {"firstName":“Sumit Kumar", "lastName":“Shah"}, {"firstName":“Shiva K.", "lastName":“Shrestha"} ]} <employees> <employee> <firstName>Anju</firstName> <lastName>Shah</lastName> </employee> <employee> <firstName>Sumit Kumar</firstName> <lastName>Shah</lastName> </employee> <employee> <firstName>Shiva K.</firstName> <lastName>Shrestha</lastName> </employee> </employees> 12
  • 13. Terminology Translation 13 SQL Terms/Concepts MongoDB Terms/Concepts database database table collection row document column field index index table joins (e.g. select queries) embedded documents and linking Primary keys _id field is always the primary key Aggregation (e.g. group by) aggregation pipeline
  • 14. MongoDB Data Model 14 A collection includes documents.
  • 15. MongoDB Data Model 15 Structure of a JSON-document: The value of field:  Native data types  Arrays  Other documents
  • 16. MongoDB Data Model 16 Embedded documents: The primary key
  • 17. Installation • Download and install suitable package for each platform [Windows, Linux, Mac OSX, Solaris] • Create a folder e.g. C:mongodb • Go to bin of installation folder. • Type following command: mongod --dbpath=C:/mongodb • Run another command: mongo.exe • The mongodb server is running. 17
  • 18. CRUD  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> ) 18
  • 19. CRUD example > db.user.insert({ first: "John", last : "Doe", age: 39 }) > db.user.find () { "_id" : ObjectId("51…"), "first" : "John", "last" : "Doe", "age" : 39 } > db.user.update( {"_id" : ObjectId("51…")}, { $set: { age: 40, salary: 7000} } ) > db.user.remove({ "first": /^J/ }) 19
  • 20. Conclusions  MongoDB is fast  Very little CPU overhead  Implemented in C++ for best performance  Free & Open Source, Cross-Platform, Document Oriented  Easier and faster integration of data  useful when working with a huge quantity of data when the data's nature does not require a relational model  used when what really matters is the ability to store and retrieve great quantities of data, not the relationships between the elements.  Works on many platforms and there are many language drivers 20

Editor's Notes

  • #4: https://infocus.emc.com/april_reeve/big-data-and-nosql-the-problem-with-relational-databases/ 1min
  • #6: https://www.mongodb.com/nosql-explained http://aryannava.com/2014/04/06/nosql-databases-family/
  • #9: Easy Assess Provide up-to-date copy of data Easily added extra column without affecting others Secured Monitored, automated & integrated with our existing infrastructure Millions ops/sec, 100 Billions Documents, Peta Bytes of Data
  • #14: What is the index in MongoDB Embedded documents and linking?? Aggregation pipeline?? http://docs.mongodb.org/manual/core/data-model-design/
  • #15: The schema is very flexible. Documents in each collection can have different structures.
  • #16: The schema is very flexible. Documents in each collection can have different structures.
  • #17: With embedded documents, we do not need complicated join table. Why objectId1 – a hex string
  • #19: Create The field name _id is reserved for use as a primary key; its value must be unique in the collection, is immutable, and may be of any type other than an array. The field names cannot start with the $ character. The field names cannot contain the . character. Create with save If the <document> argument does not contain the _id field or contains an _id field with a value not in the collection, the save() method performs an insert of the document. Otherwise, the save() method performs an update. sds