SlideShare a Scribd company logo
1 of 29
Introduction to
MongoDB
Surya Prakash
Gupta
Agenda
Presentation Title
Introduction to MongoDB 2
 What is NoSQL?
 Types of NoSQL
 SQL Vs NoSQL
 When to use NoSQL?
 What is MongoDB?
 Features of MongoDB
 MongoDB Data types
 Who’s using MongoDB?
 MongoDB terms
 MongoDB Installation
 Some MongoDB commands
 MongoDB Compass & MongoDB
Atlas
 References
What is NoSQL Database?
Introduction to MongoDB 3
 The term “NoSQL database” refer to any “Non-relational” or “Not only SQL” databases
provides a mechanism for storage and retrieval of data in a format other than tabular relations
model used in relational databases.
 NoSQL database doesn't use tables for storing data.
 It is generally used to store big data and real-time web applications.
 Flexible schema i.e., no predefined or rigid schema.
 It avoids joins and is easy to scale.
Types of NoSQL Database
Introduction to MongoDB 4
NoSQL Databases are mainly categorized into four types: Key-value pair, Column-oriented,
Graph-based & Document-oriented.
SQL Vs NoSQL
Introduction to MongoDB 5
SQL NoSQL
SQL databases are primarily called
RDBMS or Relational Databases.
NoSQL databases are primarily called
as Non-relational or distributed
database.
SQL databases are table-based
databases.
NoSQL databases can be document
based, key-value pairs, graph
databases.
Vertical Scalability Horizontal Scalability
Fixed or Predefined schema. Flexible schema.
Not suitable for hierarchical data storage. Suitable for hierarchical data storage.
Oracle, MySQL, Microsoft SQL Server,
and PostgreSQL.
Document: MongoDB and CouchDB,
Key-value: Redis and DynamoDB,
Column-based: Cassandra and HBase,
Graph: Neo4j and Amazon Neptune.
When to use NoSQL?
Introduction to MongoDB 6
1. When a huge amount of data needs to be stored and retrieved.
2. The relationship between the data you store is not that important
3. The data changes over time and is not structured.
4. Constraints and Joins support is not required at database level.
5. The data is growing continuously, and you need to scale the database regularly to handle
the data.
What is MongoDB?
Introduction to MongoDB 7
 Most popular NoSQL database.
 Open-source document-oriented database.
 Its scale-out architecture allows you to meet the
increasing demand for your system by adding
more nodes to share the load.
 MongoDB uses BSON (Binary JSON) to query
database.
 Stores data in the form of BSON documents.
Features of MongoDB
Introduction to MongoDB 8
 Indexing: Efficient search & data processing in very less time.
 Scalability: MongoDB scales horizontally using sharding (partitioning data across various
servers). Also, new machines can be added to a running database.
 Replication & High Availability: Multiple copies of data is replicated on different servers
which protects the database from hardware failures. If one server goes down, the data can
be retrieved easily from other active servers which also had the data stored on them.
 Load balancing: It has an automatic load balancing configuration because of data placed in
shards.
 Aggregation: Aggregation operations process data records and return the computed
results. It is like the GROUPBY clause in SQL. A few aggregation expressions are sum, avg,
min, max, etc.
 Languages supported: The list of supported languages includes Node.js, C, C++,
C#, Go, Java, Perl, PHP, Python, Ruby, Rust, Scala, and Swift.
MongoDB Data Types
Introduction to MongoDB 9
Who’s is using MongoDB?
Introduction to MongoDB 10
MongoDB has been adopted as backend software by a few major websites and services
including Toyota, Cisco, Shutterfly, Adobe, Ericsson, Craigslist, eBay, and Foursquare.
MongoDB Terms
Introduction to MongoDB 11
 Databases: A database stores one or more collections of documents.
 Collections: MongoDB stores documents in collections. Collections are analogous to tables
in relational databases.
 Documents: MongoDB stores data records as BSON documents & similar to JSON
objects. It is analogous to row in relational databases. These are composed of field-and-value
pairs and have the following structure:
{
field1: value1,
field2: value2,
field3: value3,
...
fieldN: valueN
}
 Fields Names: These are strings analogous to column in relational databases.
Example
Introduction to MongoDB 12
SQL Vs MongoDB Terms
Introduction to MongoDB 13
MongoDB Installation
Introduction to MongoDB 14
 MongoDB is available in two server editions: Community and Enterprise.
 Community edition is free & Enterprise edition is a paid version and has some advanced
features.
 Installation links:
Install MongoDB — MongoDB Manual
Community: Try MongoDB Community Edition | MongoDB
Enterprise: Try MongoDB Enterprise Advanced | MongoDB
Create Database
Introduction to MongoDB 15
The use Database_name command makes a new database in the system if it does not exist, if
the database exists it uses that database.
For example, use mydb.
Now your database is ready of name mydb.
List all databases
Introduction to MongoDB 16
To list down all the databases, use the command below:
show dbs
This command lists down all the databases and their size on the disk.
mydb database is not created until you save a document in it.
Create Collection
Introduction to MongoDB 17
To create collection, use the command below:
db.createCollection(name, options)
name is name of collection to be created. Options is a document and is used to specify
configuration of collection such as capped, autoIndexId, size.
List all Collections
Introduction to MongoDB 18
To see all collections in a database, use the command below:
show collections
Drop Database & Collection
Introduction to MongoDB 19
 Use the following command to delete a database:
db.dropDatabase()
 Use the following command to delete a collection:
db.collection_name.drop()
Create Documents
Introduction to MongoDB 20
Two methods insert or create documents in collection:
1. db.collection_name.insertOne()
2. db.collection_name.insertMany()
Retrieving Documents
Introduction to MongoDB 21
 Use the below command to retrieve documents:
db.collection_name.find()
 For a proper formatted output, use the below command: pretty() with find().
db.collection_name.find().pretty()
Retrieving Documents
Introduction to MongoDB 22
Retrieving Documents with Filters or
Criteria
Introduction to MongoDB 23
Update Documents
Introduction to MongoDB 24
 There are 2 ways to update documents:
1. db.collection_name.updateOne()
2. db.collection_name.updateMany()
Update Documents
Introduction to MongoDB 25
Delete Documents
Introduction to MongoDB 26
 There are 2 ways to delete documents:
1. db.collection_name.deleteOne()
2. db.collection_name.deleteMany()
MongoDB Compass & MongoDB Atlas
Introduction to MongoDB 27
 MongoDB Compass is a powerful GUI for querying, aggregating, and analyzing your
MongoDB data in a visual environment. It is free to use and can be run on macOS,
Windows, and Linux.
 Installation link: MongoDB Compass Download | MongoDB
 MongoDB Atlas is a multi-cloud database service by the same people that build MongoDB.
It makes easy to deploy and manage databases on-demand when and where you need
them.
 Get Started with Atlas — MongoDB Atlas
References
Introduction to MongoDB 28
 MongoDB Documentation
 MongoDB - OneCompiler - Write, run and share MongoDB code online
 Online mongoDB Terminal - practice mongoDB online (jdoodle.com)
 MongoDB Exercises, Practice, Solution - w3resource
Thank you

More Related Content

What's hot

Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBMongoDB
 
Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)Kai Zhao
 
Mongo Nosql CRUD Operations
Mongo Nosql CRUD OperationsMongo Nosql CRUD Operations
Mongo Nosql CRUD Operationsanujaggarwal49
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to RedisArnab Mitra
 
NoSQL databases - An introduction
NoSQL databases - An introductionNoSQL databases - An introduction
NoSQL databases - An introductionPooyan Mehrparvar
 
9. Document Oriented Databases
9. Document Oriented Databases9. Document Oriented Databases
9. Document Oriented DatabasesFabio Fumarola
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBNodeXperts
 
MongoDB Fundamentals
MongoDB FundamentalsMongoDB Fundamentals
MongoDB FundamentalsMongoDB
 
An introduction to MongoDB
An introduction to MongoDBAn introduction to MongoDB
An introduction to MongoDBCésar Trigo
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBMike Dirolf
 
MongoDB Schema Design: Four Real-World Examples
MongoDB Schema Design: Four Real-World ExamplesMongoDB Schema Design: Four Real-World Examples
MongoDB Schema Design: Four Real-World ExamplesMike Friedman
 
Non relational databases-no sql
Non relational databases-no sqlNon relational databases-no sql
Non relational databases-no sqlRam kumar
 

What's hot (20)

MongoDB
MongoDBMongoDB
MongoDB
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)
 
Mongo Nosql CRUD Operations
Mongo Nosql CRUD OperationsMongo Nosql CRUD Operations
Mongo Nosql CRUD Operations
 
Mongo db intro.pptx
Mongo db intro.pptxMongo db intro.pptx
Mongo db intro.pptx
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Mongo DB Presentation
Mongo DB PresentationMongo DB Presentation
Mongo DB Presentation
 
MongoDB 101
MongoDB 101MongoDB 101
MongoDB 101
 
NoSQL databases - An introduction
NoSQL databases - An introductionNoSQL databases - An introduction
NoSQL databases - An introduction
 
9. Document Oriented Databases
9. Document Oriented Databases9. Document Oriented Databases
9. Document Oriented Databases
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
MongoDB Fundamentals
MongoDB FundamentalsMongoDB Fundamentals
MongoDB Fundamentals
 
An introduction to MongoDB
An introduction to MongoDBAn introduction to MongoDB
An introduction to MongoDB
 
Node js
Node jsNode js
Node js
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Mongo db
Mongo dbMongo db
Mongo db
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
MongoDB Schema Design: Four Real-World Examples
MongoDB Schema Design: Four Real-World ExamplesMongoDB Schema Design: Four Real-World Examples
MongoDB Schema Design: Four Real-World Examples
 
Non relational databases-no sql
Non relational databases-no sqlNon relational databases-no sql
Non relational databases-no sql
 
Introduction to NoSQL
Introduction to NoSQLIntroduction to NoSQL
Introduction to NoSQL
 

Similar to Introduction to MongoDB.pptx

MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introductiondinkar thakur
 
mongodb11 (1) (1).pptx
mongodb11 (1) (1).pptxmongodb11 (1) (1).pptx
mongodb11 (1) (1).pptxRoopaR36
 
Mongodb - NoSql Database
Mongodb - NoSql DatabaseMongodb - NoSql Database
Mongodb - NoSql DatabasePrashant Gupta
 
MongoDB Lab Manual (1).pdf used in data science
MongoDB Lab Manual (1).pdf used in data scienceMongoDB Lab Manual (1).pdf used in data science
MongoDB Lab Manual (1).pdf used in data sciencebitragowthamkumar1
 
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 practicesAshishRathore72
 
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introductionsethfloydjr
 
A Study on Mongodb Database.pdf
A Study on Mongodb Database.pdfA Study on Mongodb Database.pdf
A Study on Mongodb Database.pdfJessica Navarro
 
A Study on Mongodb Database
A Study on Mongodb DatabaseA Study on Mongodb Database
A Study on Mongodb DatabaseIJSRD
 
Everything You Need to Know About MongoDB Development.pptx
Everything You Need to Know About MongoDB Development.pptxEverything You Need to Know About MongoDB Development.pptx
Everything You Need to Know About MongoDB Development.pptx75waytechnologies
 
nosql [Autosaved].pptx
nosql [Autosaved].pptxnosql [Autosaved].pptx
nosql [Autosaved].pptxIndrani Sen
 
No SQL - MongoDB
No SQL - MongoDBNo SQL - MongoDB
No SQL - MongoDBMirza Asif
 
Kalp Corporate MongoDB Tutorials
Kalp Corporate MongoDB TutorialsKalp Corporate MongoDB Tutorials
Kalp Corporate MongoDB TutorialsKalp Corporate
 
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 -MyWhitePaperRajesh Kumar
 

Similar to Introduction to MongoDB.pptx (20)

Mongodb By Vipin
Mongodb By VipinMongodb By Vipin
Mongodb By Vipin
 
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introduction
 
Mongo db dhruba
Mongo db dhrubaMongo db dhruba
Mongo db dhruba
 
mongodb11 (1) (1).pptx
mongodb11 (1) (1).pptxmongodb11 (1) (1).pptx
mongodb11 (1) (1).pptx
 
MongoDB
MongoDBMongoDB
MongoDB
 
Mongodb - NoSql Database
Mongodb - NoSql DatabaseMongodb - NoSql Database
Mongodb - NoSql Database
 
MongoDB Lab Manual (1).pdf used in data science
MongoDB Lab Manual (1).pdf used in data scienceMongoDB Lab Manual (1).pdf used in data science
MongoDB Lab Manual (1).pdf used in data science
 
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
 
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introduction
 
Mongodb
MongodbMongodb
Mongodb
 
A Study on Mongodb Database.pdf
A Study on Mongodb Database.pdfA Study on Mongodb Database.pdf
A Study on Mongodb Database.pdf
 
A Study on Mongodb Database
A Study on Mongodb DatabaseA Study on Mongodb Database
A Study on Mongodb Database
 
Everything You Need to Know About MongoDB Development.pptx
Everything You Need to Know About MongoDB Development.pptxEverything You Need to Know About MongoDB Development.pptx
Everything You Need to Know About MongoDB Development.pptx
 
nosql [Autosaved].pptx
nosql [Autosaved].pptxnosql [Autosaved].pptx
nosql [Autosaved].pptx
 
No SQL - MongoDB
No SQL - MongoDBNo SQL - MongoDB
No SQL - MongoDB
 
Mongo DB
Mongo DBMongo DB
Mongo DB
 
Kalp Corporate MongoDB Tutorials
Kalp Corporate MongoDB TutorialsKalp Corporate MongoDB Tutorials
Kalp Corporate MongoDB Tutorials
 
Mongo db
Mongo dbMongo db
Mongo db
 
MongoDB DOC v1.5
MongoDB DOC v1.5MongoDB DOC v1.5
MongoDB DOC v1.5
 
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
 

Recently uploaded

Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringWSO2
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
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 2024Victor Rentea
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
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.pdfOrbitshub
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc
 
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 DevelopersWSO2
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
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 SavingEdi Saputra
 
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 FMESafe Software
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....rightmanforbloodline
 
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 ABDMKumar Satyam
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuidePixlogix Infotech
 
Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaWSO2
 

Recently uploaded (20)

Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software Engineering
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
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
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
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
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
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
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
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
 
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
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
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
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using Ballerina
 

Introduction to MongoDB.pptx

  • 2. Agenda Presentation Title Introduction to MongoDB 2  What is NoSQL?  Types of NoSQL  SQL Vs NoSQL  When to use NoSQL?  What is MongoDB?  Features of MongoDB  MongoDB Data types  Who’s using MongoDB?  MongoDB terms  MongoDB Installation  Some MongoDB commands  MongoDB Compass & MongoDB Atlas  References
  • 3. What is NoSQL Database? Introduction to MongoDB 3  The term “NoSQL database” refer to any “Non-relational” or “Not only SQL” databases provides a mechanism for storage and retrieval of data in a format other than tabular relations model used in relational databases.  NoSQL database doesn't use tables for storing data.  It is generally used to store big data and real-time web applications.  Flexible schema i.e., no predefined or rigid schema.  It avoids joins and is easy to scale.
  • 4. Types of NoSQL Database Introduction to MongoDB 4 NoSQL Databases are mainly categorized into four types: Key-value pair, Column-oriented, Graph-based & Document-oriented.
  • 5. SQL Vs NoSQL Introduction to MongoDB 5 SQL NoSQL SQL databases are primarily called RDBMS or Relational Databases. NoSQL databases are primarily called as Non-relational or distributed database. SQL databases are table-based databases. NoSQL databases can be document based, key-value pairs, graph databases. Vertical Scalability Horizontal Scalability Fixed or Predefined schema. Flexible schema. Not suitable for hierarchical data storage. Suitable for hierarchical data storage. Oracle, MySQL, Microsoft SQL Server, and PostgreSQL. Document: MongoDB and CouchDB, Key-value: Redis and DynamoDB, Column-based: Cassandra and HBase, Graph: Neo4j and Amazon Neptune.
  • 6. When to use NoSQL? Introduction to MongoDB 6 1. When a huge amount of data needs to be stored and retrieved. 2. The relationship between the data you store is not that important 3. The data changes over time and is not structured. 4. Constraints and Joins support is not required at database level. 5. The data is growing continuously, and you need to scale the database regularly to handle the data.
  • 7. What is MongoDB? Introduction to MongoDB 7  Most popular NoSQL database.  Open-source document-oriented database.  Its scale-out architecture allows you to meet the increasing demand for your system by adding more nodes to share the load.  MongoDB uses BSON (Binary JSON) to query database.  Stores data in the form of BSON documents.
  • 8. Features of MongoDB Introduction to MongoDB 8  Indexing: Efficient search & data processing in very less time.  Scalability: MongoDB scales horizontally using sharding (partitioning data across various servers). Also, new machines can be added to a running database.  Replication & High Availability: Multiple copies of data is replicated on different servers which protects the database from hardware failures. If one server goes down, the data can be retrieved easily from other active servers which also had the data stored on them.  Load balancing: It has an automatic load balancing configuration because of data placed in shards.  Aggregation: Aggregation operations process data records and return the computed results. It is like the GROUPBY clause in SQL. A few aggregation expressions are sum, avg, min, max, etc.  Languages supported: The list of supported languages includes Node.js, C, C++, C#, Go, Java, Perl, PHP, Python, Ruby, Rust, Scala, and Swift.
  • 10. Who’s is using MongoDB? Introduction to MongoDB 10 MongoDB has been adopted as backend software by a few major websites and services including Toyota, Cisco, Shutterfly, Adobe, Ericsson, Craigslist, eBay, and Foursquare.
  • 11. MongoDB Terms Introduction to MongoDB 11  Databases: A database stores one or more collections of documents.  Collections: MongoDB stores documents in collections. Collections are analogous to tables in relational databases.  Documents: MongoDB stores data records as BSON documents & similar to JSON objects. It is analogous to row in relational databases. These are composed of field-and-value pairs and have the following structure: { field1: value1, field2: value2, field3: value3, ... fieldN: valueN }  Fields Names: These are strings analogous to column in relational databases.
  • 13. SQL Vs MongoDB Terms Introduction to MongoDB 13
  • 14. MongoDB Installation Introduction to MongoDB 14  MongoDB is available in two server editions: Community and Enterprise.  Community edition is free & Enterprise edition is a paid version and has some advanced features.  Installation links: Install MongoDB — MongoDB Manual Community: Try MongoDB Community Edition | MongoDB Enterprise: Try MongoDB Enterprise Advanced | MongoDB
  • 15. Create Database Introduction to MongoDB 15 The use Database_name command makes a new database in the system if it does not exist, if the database exists it uses that database. For example, use mydb. Now your database is ready of name mydb.
  • 16. List all databases Introduction to MongoDB 16 To list down all the databases, use the command below: show dbs This command lists down all the databases and their size on the disk. mydb database is not created until you save a document in it.
  • 17. Create Collection Introduction to MongoDB 17 To create collection, use the command below: db.createCollection(name, options) name is name of collection to be created. Options is a document and is used to specify configuration of collection such as capped, autoIndexId, size.
  • 18. List all Collections Introduction to MongoDB 18 To see all collections in a database, use the command below: show collections
  • 19. Drop Database & Collection Introduction to MongoDB 19  Use the following command to delete a database: db.dropDatabase()  Use the following command to delete a collection: db.collection_name.drop()
  • 20. Create Documents Introduction to MongoDB 20 Two methods insert or create documents in collection: 1. db.collection_name.insertOne() 2. db.collection_name.insertMany()
  • 21. Retrieving Documents Introduction to MongoDB 21  Use the below command to retrieve documents: db.collection_name.find()  For a proper formatted output, use the below command: pretty() with find(). db.collection_name.find().pretty()
  • 23. Retrieving Documents with Filters or Criteria Introduction to MongoDB 23
  • 24. Update Documents Introduction to MongoDB 24  There are 2 ways to update documents: 1. db.collection_name.updateOne() 2. db.collection_name.updateMany()
  • 26. Delete Documents Introduction to MongoDB 26  There are 2 ways to delete documents: 1. db.collection_name.deleteOne() 2. db.collection_name.deleteMany()
  • 27. MongoDB Compass & MongoDB Atlas Introduction to MongoDB 27  MongoDB Compass is a powerful GUI for querying, aggregating, and analyzing your MongoDB data in a visual environment. It is free to use and can be run on macOS, Windows, and Linux.  Installation link: MongoDB Compass Download | MongoDB  MongoDB Atlas is a multi-cloud database service by the same people that build MongoDB. It makes easy to deploy and manage databases on-demand when and where you need them.  Get Started with Atlas — MongoDB Atlas
  • 28. References Introduction to MongoDB 28  MongoDB Documentation  MongoDB - OneCompiler - Write, run and share MongoDB code online  Online mongoDB Terminal - practice mongoDB online (jdoodle.com)  MongoDB Exercises, Practice, Solution - w3resource