SlideShare a Scribd company logo
1 of 20
MongoDB
Ram Murat Sharma | @rammrms | rammurat.rms.sharma0@gmail.com
Agenda
 Prerequisite
 Introduction to MongoDB
 MongoDB vs RDBMS Structure
 Basic CRUD Operations
 Create, Update, Delete & Drop
 Sort, Limit & Indexing
 Where Clause
 Aggregation()
 Connect with Node
 Sharding
 Replication
 Backup/Restore Data
 Access MongoDB with Server Side language (Node)
 Why MongoDB?
 Questions
Prerequisites
 What you should know already
 Basic knowledge of JavaScript
 Basic knowledge of Server Side language
 Good knowledge of JSON
 Good knowledge of Database
 Technical preparations
 Any browser running on your laptop/Desktop
 Any server side language running like PHP, Node etc.
 Your IDE or code editor of choice
 Any server running to respond query like Tomcat, Xampp or
Node
Introduction to MongoDB
MongoDB is a cross-platform, document oriented
database that provides, high performance, high
availability, and easy scalability.
Key Structure
 Database - Database is a physical container for collections. Each database
gets its own set of files on the file system.
 Collection - Collection is a group of MongoDB documents. It is the equivalent
of an RDBMS table. A collection exists within a single database. Documents
within a collection can have different fields. Typically, all documents in a
collection are of similar or related purpose.
 Document - A document is a set of key-value pairs. Documents have dynamic
schema. Dynamic schema means that documents in the same collection do
not need to have the same set of fields or structure.
RDBMS MongoDB
Database Database
Table Collection
Row Document
Column Field
Join Embedded Documents
Primary Key _id (Provided by MongoDB)
Database Server and Client
MySqlD/Oracle mongoD
MySql/SqlPlus mongo
RDBMS VS MongoDB
Structure Example
SQL No SQL
Basic Commands
Operation Command
Create Database Use <dbname>
Switch Database Use <dbname>
List current Database Db
List all databases Show dbs
Drop Database Db.dropDatabase()
Create Collection db.createCollection(name, options)
db.createCollection(“Sapient”, {max:1000})
List collection Show collections
Drop Collection db.COLLECTION_NAME.drop()
Operation Command
Insert Document db.COLLECTION_NAME.insert(document)
db.employees.insert({
‘title’: ‘Associate L2',
‘oracle_id’: 104495,
‘education’: [‘BCA', ‘MCA'],
‘projects’:{ ‘id’:232323,’Strengh’:60 }
})
Update Document db.COLLECTION_NAME.update(SELECTIOIN_C
RITERIA, UPDATED_DATA)
db.employees.update(
{ ‘oracle_id’: 104495},
{ $set: {‘title’: ‘Senior Associate L2’}}
)
Delete Document(s)
Delete one record from result set in case
multiple records
db.COLLECTION_NAME.remove(DELLETION_C
RITTERIA)
db.employees.remove({'title':‘Associate L2'})
db.employees.remove({'title':‘Associate L2'},1)
Operation Command
Empty Document db.COLLECTION_NAME.remove()
Find Document(s) db.COLLECTION_NAME.find()
db.employees.find()
db.employees.find().pretty()
db.employees.find(
{ ‘oracle_id’: 104495}
).pretty()
Find (Projection)
Limit the result set
db.COLLECTION_NAME.find({},{KEY:1})
Where Clause in MongoDB
Operation MongoDB RDBMS
Equality db.employees.find({“salary":“5000"}) where ‘salary ‘= ‘5000’
Less Than db.employees.find({“age":{$lt:30}}) where age < 30
Less Than
Equals
db.employees.find({“age":{$lte:30}}) where age <= 30
Greater Than db.employees.find({“age":{$gt:30}}) where age > 30
Greater Than
Equals
db.employees.find({“age":{$gte:30}}) where age >= 30
Not Equals db.employees.find({“age":{$ne:30}}) where age != 30
Operation Command
Sorting
(1 Asc)
(-1 Desc)
db.COLLECTION_NAME.find().sort({KEY:1})
db.employees.find({"title":’Associate L2’}).sort({‘title’:1})
Limit records db.COLLECTION_NAME.find().limit(NUMBER)
db.employees.find({"title":’Associate L2’}).limit(2)
Skip records db.COLLECTION_NAME.find().limit(NUMBER).skip(NUMBER)
db.employees.find({"title":’Associate L2’}).skip(1)
Indexing db.COLLECTION_NAME.ensureIndex({KEY:1})
db.employees.ensureIndex({"title":1})
Aggregation()
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 “group
by” is an equivalent of mongodb aggregation.
 Syntax - db.employees.aggregate([{$group : {_id :
"$oracle_id", title : {$sum : 1}}}])
 Options - $avg, $min, $max, $push , $first & $last
Connect with NODE
MongoDB Dump/Restore
To create backup of database in mongodb you should
use mongodump command. This command will dump all data of
your server into dump directory. There are many options available
by which you can limit the amount of data or create backup of your
remote server.
 Steps:
 Make sure mongo server is running
 Go to bin Mongo bin/ directory
 Type mongodump/mongorestore
 Look for bin/dump/ folder, it contains dump data now
Sharding
Sharding is the process of storing data records across multiple
macines and it is MongoDB’s approach to meeting the demands of
data growth.
Problem – As the size of the data increases, a single machine may
not be sufficient to store the data nor provide an acceptable read
and write throughput.
Solution – Sharding this problem with horizontal scaling where you
can add more machines to support data growth and the demands of
read and write operations.
Why Replication?
Replication is the process of synchronizing data across multiple servers.
Replication provides redundancy and increases data availability with
multiple copies of data on different database servers, replication protects
a database from the loss of a single server. Replication also allows you to
recover from hardware failure and service interruptions. With additional
copies of the data, you can dedicate one to disaster recovery, reporting, or
backup.
• To keep your data safe
• High availability of data (24*7)
• Disaster Recovery
• No downtime for maintenance (like backups, index rebuilds,
compaction)
• Read scaling (extra copies to read from)
Replication
Why MongoDB?
 Document Database
 Documents (objects) map nicely to programming language data types.
 Embedded documents and arrays reduce need for joins.
 Dynamic schema
 High Performance
 Embedding makes reads and writes fast.
 Indexes can include keys from embedded documents and arrays.
 High Availability
 Replicated servers with automatic master failover.
 Easy Scalability
 Automatic sharding distributes collection data across machines.
 Consistent reads can be distributed over replicated servers.
 Brands prefers Mongo - FourSquare, Adobe, McAfee, Ebay, Fifa, MetLife, Forbes and
more…
Questions?
&
Feedbacks
Thank You

More Related Content

What's hot

What's hot (20)

CouchDB
CouchDBCouchDB
CouchDB
 
Introduction à DocumentDB
Introduction à DocumentDBIntroduction à DocumentDB
Introduction à DocumentDB
 
Azure sql database limitations
Azure sql database limitationsAzure sql database limitations
Azure sql database limitations
 
Deep dive into the native multi model database ArangoDB
Deep dive into the native multi model database ArangoDBDeep dive into the native multi model database ArangoDB
Deep dive into the native multi model database ArangoDB
 
Lecture12
Lecture12Lecture12
Lecture12
 
Azure DocumentDB
Azure DocumentDBAzure DocumentDB
Azure DocumentDB
 
Benjamin Guinebertière - Microsoft Azure: Document DB and other noSQL databas...
Benjamin Guinebertière - Microsoft Azure: Document DB and other noSQL databas...Benjamin Guinebertière - Microsoft Azure: Document DB and other noSQL databas...
Benjamin Guinebertière - Microsoft Azure: Document DB and other noSQL databas...
 
5\9 SSIS 2008R2_Training - DataFlow Basics
5\9 SSIS 2008R2_Training - DataFlow Basics5\9 SSIS 2008R2_Training - DataFlow Basics
5\9 SSIS 2008R2_Training - DataFlow Basics
 
Using schemas in parsing xml part 1
Using schemas in parsing xml part 1Using schemas in parsing xml part 1
Using schemas in parsing xml part 1
 
Azure doc db (slideshare)
Azure doc db (slideshare)Azure doc db (slideshare)
Azure doc db (slideshare)
 
Introduction To MongoDB
Introduction To MongoDBIntroduction To MongoDB
Introduction To MongoDB
 
2\9.SSIS 2008R2 _Training - Control Flow
2\9.SSIS 2008R2 _Training - Control Flow2\9.SSIS 2008R2 _Training - Control Flow
2\9.SSIS 2008R2 _Training - Control Flow
 
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introduction
 
Cool NoSQL on Azure with DocumentDB
Cool NoSQL on Azure with DocumentDBCool NoSQL on Azure with DocumentDB
Cool NoSQL on Azure with DocumentDB
 
Mongodb basics and architecture
Mongodb basics and architectureMongodb basics and architecture
Mongodb basics and architecture
 
MongoDB
MongoDBMongoDB
MongoDB
 
JS App Architecture
JS App ArchitectureJS App Architecture
JS App Architecture
 
7\9 SSIS 2008R2_Training - Script Task
7\9 SSIS 2008R2_Training - Script Task7\9 SSIS 2008R2_Training - Script Task
7\9 SSIS 2008R2_Training - Script Task
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
JDBC ppt
JDBC pptJDBC ppt
JDBC ppt
 

Similar to MongoDB - A next-generation database that lets you create applications never before possible.

Ado.net &amp; data persistence frameworks
Ado.net &amp; data persistence frameworksAdo.net &amp; data persistence frameworks
Ado.net &amp; data persistence frameworks
Luis Goldster
 
introtomongodb
introtomongodbintrotomongodb
introtomongodb
saikiran
 
Deploying MediaWiki On IBM DB2 in The Cloud Presentation
Deploying MediaWiki On IBM DB2 in The Cloud PresentationDeploying MediaWiki On IBM DB2 in The Cloud Presentation
Deploying MediaWiki On IBM DB2 in The Cloud Presentation
Leons Petražickis
 
DynamoDB Gluecon 2012
DynamoDB Gluecon 2012DynamoDB Gluecon 2012
DynamoDB Gluecon 2012
Appirio
 

Similar to MongoDB - A next-generation database that lets you create applications never before possible. (20)

Nosql seminar
Nosql seminarNosql seminar
Nosql seminar
 
MongoDB 3.4 webinar
MongoDB 3.4 webinarMongoDB 3.4 webinar
MongoDB 3.4 webinar
 
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
 
Introduction to Apache Tajo: Data Warehouse for Big Data
Introduction to Apache Tajo: Data Warehouse for Big DataIntroduction to Apache Tajo: Data Warehouse for Big Data
Introduction to Apache Tajo: Data Warehouse for Big Data
 
Ado.net &amp; data persistence frameworks
Ado.net &amp; data persistence frameworksAdo.net &amp; data persistence frameworks
Ado.net &amp; data persistence frameworks
 
DBVersity MongoDB Online Training Presentations
DBVersity MongoDB Online Training PresentationsDBVersity MongoDB Online Training Presentations
DBVersity MongoDB Online Training Presentations
 
HadoopDB
HadoopDBHadoopDB
HadoopDB
 
MongoDB_ppt.pptx
MongoDB_ppt.pptxMongoDB_ppt.pptx
MongoDB_ppt.pptx
 
introtomongodb
introtomongodbintrotomongodb
introtomongodb
 
MongoDB NoSQL database a deep dive -MyWhitePaper
MongoDB  NoSQL database a deep dive -MyWhitePaperMongoDB  NoSQL database a deep dive -MyWhitePaper
MongoDB NoSQL database a deep dive -MyWhitePaper
 
MongoDB Introduction and Data Modelling
MongoDB Introduction and Data Modelling MongoDB Introduction and Data Modelling
MongoDB Introduction and Data Modelling
 
fard car.pptx
fard car.pptxfard car.pptx
fard car.pptx
 
MongoDB using Grails plugin by puneet behl
MongoDB using Grails plugin by puneet behlMongoDB using Grails plugin by puneet behl
MongoDB using Grails plugin by puneet behl
 
Deploying MediaWiki On IBM DB2 in The Cloud Presentation
Deploying MediaWiki On IBM DB2 in The Cloud PresentationDeploying MediaWiki On IBM DB2 in The Cloud Presentation
Deploying MediaWiki On IBM DB2 in The Cloud Presentation
 
Mongodb
MongodbMongodb
Mongodb
 
Mongodb
MongodbMongodb
Mongodb
 
DynamoDB Gluecon 2012
DynamoDB Gluecon 2012DynamoDB Gluecon 2012
DynamoDB Gluecon 2012
 
Gluecon 2012 - DynamoDB
Gluecon 2012 - DynamoDBGluecon 2012 - DynamoDB
Gluecon 2012 - DynamoDB
 
SQL vs NoSQL, an experiment with MongoDB
SQL vs NoSQL, an experiment with MongoDBSQL vs NoSQL, an experiment with MongoDB
SQL vs NoSQL, an experiment with MongoDB
 
Klevis Mino: MongoDB
Klevis Mino: MongoDBKlevis Mino: MongoDB
Klevis Mino: MongoDB
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Recently uploaded (20)

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 

MongoDB - A next-generation database that lets you create applications never before possible.

  • 1. MongoDB Ram Murat Sharma | @rammrms | rammurat.rms.sharma0@gmail.com
  • 2. Agenda  Prerequisite  Introduction to MongoDB  MongoDB vs RDBMS Structure  Basic CRUD Operations  Create, Update, Delete & Drop  Sort, Limit & Indexing  Where Clause  Aggregation()  Connect with Node  Sharding  Replication  Backup/Restore Data  Access MongoDB with Server Side language (Node)  Why MongoDB?  Questions
  • 3. Prerequisites  What you should know already  Basic knowledge of JavaScript  Basic knowledge of Server Side language  Good knowledge of JSON  Good knowledge of Database  Technical preparations  Any browser running on your laptop/Desktop  Any server side language running like PHP, Node etc.  Your IDE or code editor of choice  Any server running to respond query like Tomcat, Xampp or Node
  • 4. Introduction to MongoDB MongoDB is a cross-platform, document oriented database that provides, high performance, high availability, and easy scalability. Key Structure  Database - Database is a physical container for collections. Each database gets its own set of files on the file system.  Collection - Collection is a group of MongoDB documents. It is the equivalent of an RDBMS table. A collection exists within a single database. Documents within a collection can have different fields. Typically, all documents in a collection are of similar or related purpose.  Document - A document is a set of key-value pairs. Documents have dynamic schema. Dynamic schema means that documents in the same collection do not need to have the same set of fields or structure.
  • 5. RDBMS MongoDB Database Database Table Collection Row Document Column Field Join Embedded Documents Primary Key _id (Provided by MongoDB) Database Server and Client MySqlD/Oracle mongoD MySql/SqlPlus mongo RDBMS VS MongoDB
  • 7. Basic Commands Operation Command Create Database Use <dbname> Switch Database Use <dbname> List current Database Db List all databases Show dbs Drop Database Db.dropDatabase() Create Collection db.createCollection(name, options) db.createCollection(“Sapient”, {max:1000}) List collection Show collections Drop Collection db.COLLECTION_NAME.drop()
  • 8. Operation Command Insert Document db.COLLECTION_NAME.insert(document) db.employees.insert({ ‘title’: ‘Associate L2', ‘oracle_id’: 104495, ‘education’: [‘BCA', ‘MCA'], ‘projects’:{ ‘id’:232323,’Strengh’:60 } }) Update Document db.COLLECTION_NAME.update(SELECTIOIN_C RITERIA, UPDATED_DATA) db.employees.update( { ‘oracle_id’: 104495}, { $set: {‘title’: ‘Senior Associate L2’}} ) Delete Document(s) Delete one record from result set in case multiple records db.COLLECTION_NAME.remove(DELLETION_C RITTERIA) db.employees.remove({'title':‘Associate L2'}) db.employees.remove({'title':‘Associate L2'},1)
  • 9. Operation Command Empty Document db.COLLECTION_NAME.remove() Find Document(s) db.COLLECTION_NAME.find() db.employees.find() db.employees.find().pretty() db.employees.find( { ‘oracle_id’: 104495} ).pretty() Find (Projection) Limit the result set db.COLLECTION_NAME.find({},{KEY:1})
  • 10. Where Clause in MongoDB Operation MongoDB RDBMS Equality db.employees.find({“salary":“5000"}) where ‘salary ‘= ‘5000’ Less Than db.employees.find({“age":{$lt:30}}) where age < 30 Less Than Equals db.employees.find({“age":{$lte:30}}) where age <= 30 Greater Than db.employees.find({“age":{$gt:30}}) where age > 30 Greater Than Equals db.employees.find({“age":{$gte:30}}) where age >= 30 Not Equals db.employees.find({“age":{$ne:30}}) where age != 30
  • 11. Operation Command Sorting (1 Asc) (-1 Desc) db.COLLECTION_NAME.find().sort({KEY:1}) db.employees.find({"title":’Associate L2’}).sort({‘title’:1}) Limit records db.COLLECTION_NAME.find().limit(NUMBER) db.employees.find({"title":’Associate L2’}).limit(2) Skip records db.COLLECTION_NAME.find().limit(NUMBER).skip(NUMBER) db.employees.find({"title":’Associate L2’}).skip(1) Indexing db.COLLECTION_NAME.ensureIndex({KEY:1}) db.employees.ensureIndex({"title":1})
  • 12. Aggregation() 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 “group by” is an equivalent of mongodb aggregation.  Syntax - db.employees.aggregate([{$group : {_id : "$oracle_id", title : {$sum : 1}}}])  Options - $avg, $min, $max, $push , $first & $last
  • 13.
  • 15. MongoDB Dump/Restore To create backup of database in mongodb you should use mongodump command. This command will dump all data of your server into dump directory. There are many options available by which you can limit the amount of data or create backup of your remote server.  Steps:  Make sure mongo server is running  Go to bin Mongo bin/ directory  Type mongodump/mongorestore  Look for bin/dump/ folder, it contains dump data now
  • 16. Sharding Sharding is the process of storing data records across multiple macines and it is MongoDB’s approach to meeting the demands of data growth. Problem – As the size of the data increases, a single machine may not be sufficient to store the data nor provide an acceptable read and write throughput. Solution – Sharding this problem with horizontal scaling where you can add more machines to support data growth and the demands of read and write operations.
  • 17. Why Replication? Replication is the process of synchronizing data across multiple servers. Replication provides redundancy and increases data availability with multiple copies of data on different database servers, replication protects a database from the loss of a single server. Replication also allows you to recover from hardware failure and service interruptions. With additional copies of the data, you can dedicate one to disaster recovery, reporting, or backup. • To keep your data safe • High availability of data (24*7) • Disaster Recovery • No downtime for maintenance (like backups, index rebuilds, compaction) • Read scaling (extra copies to read from) Replication
  • 18. Why MongoDB?  Document Database  Documents (objects) map nicely to programming language data types.  Embedded documents and arrays reduce need for joins.  Dynamic schema  High Performance  Embedding makes reads and writes fast.  Indexes can include keys from embedded documents and arrays.  High Availability  Replicated servers with automatic master failover.  Easy Scalability  Automatic sharding distributes collection data across machines.  Consistent reads can be distributed over replicated servers.  Brands prefers Mongo - FourSquare, Adobe, McAfee, Ebay, Fifa, MetLife, Forbes and more…