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

PPTX
The Basics of MongoDB
PPT
Introduction to MongoDB
PPTX
Basics of MongoDB
PPTX
MongoDB
PPTX
MongoDB presentation
PPT
Introduction to mongodb
ODP
Introduction to MongoDB
PPTX
An Introduction To NoSQL & MongoDB
The Basics of MongoDB
Introduction to MongoDB
Basics of MongoDB
MongoDB
MongoDB presentation
Introduction to mongodb
Introduction to MongoDB
An Introduction To NoSQL & MongoDB

What's hot (20)

PPTX
introduction to NOSQL Database
PPTX
Mongodb basics and architecture
PDF
MongodB Internals
PDF
NOSQL- Presentation on NoSQL
PPTX
Mongo DB Presentation
PDF
Hadoop Overview & Architecture
 
PPTX
Data models in NoSQL
PDF
Introduction to MongoDB
PPTX
Mongo db intro.pptx
ZIP
NoSQL databases
PPTX
Introduction to MongoDB
PPTX
Introduction to MongoDB
PPTX
Introduction to NoSQL
PDF
Introduction to Cassandra
PDF
Nosql data models
PDF
Introduction to column oriented databases
PDF
An introduction to MongoDB
PDF
SQL vs. NoSQL Databases
PPTX
Big data and Hadoop
PDF
Apache Spark Introduction
introduction to NOSQL Database
Mongodb basics and architecture
MongodB Internals
NOSQL- Presentation on NoSQL
Mongo DB Presentation
Hadoop Overview & Architecture
 
Data models in NoSQL
Introduction to MongoDB
Mongo db intro.pptx
NoSQL databases
Introduction to MongoDB
Introduction to MongoDB
Introduction to NoSQL
Introduction to Cassandra
Nosql data models
Introduction to column oriented databases
An introduction to MongoDB
SQL vs. NoSQL Databases
Big data and Hadoop
Apache Spark Introduction
Ad

Similar to Introduction to MongoDB.pptx (20)

PPTX
MongoDbPpt based on python installation.
PDF
MongoDB NoSQL database a deep dive -MyWhitePaper
PDF
MongoDB
PDF
MongoDB - An Introduction
PPTX
MongoDB NoSQL - Developer Guide
PDF
MongoDB Interview Questions PDF By ScholarHat
PPTX
MongoDB introduction features -presentation - 2.pptx
PDF
Mongodb
PPTX
Mongodb Introduction
PPTX
MongoDB.pptx
PPTX
Mongodb - NoSql Database
PDF
MongoDB Interview Questions PDF By ScholarHat
PDF
Introduction to MongoDB Basics from SQL to NoSQL
PPTX
Kalp Corporate MongoDB Tutorials
PPTX
Mongo db Quick Guide
PPTX
05201349_Unit_7_FSWD_ advanced learning.pptx
PPTX
05201349_Unit_7_FSWD_II(1) with advance.pptx
PDF
SQL vs NoSQL, an experiment with MongoDB
PPTX
Mongo db nosql (1)
MongoDbPpt based on python installation.
MongoDB NoSQL database a deep dive -MyWhitePaper
MongoDB
MongoDB - An Introduction
MongoDB NoSQL - Developer Guide
MongoDB Interview Questions PDF By ScholarHat
MongoDB introduction features -presentation - 2.pptx
Mongodb
Mongodb Introduction
MongoDB.pptx
Mongodb - NoSql Database
MongoDB Interview Questions PDF By ScholarHat
Introduction to MongoDB Basics from SQL to NoSQL
Kalp Corporate MongoDB Tutorials
Mongo db Quick Guide
05201349_Unit_7_FSWD_ advanced learning.pptx
05201349_Unit_7_FSWD_II(1) with advance.pptx
SQL vs NoSQL, an experiment with MongoDB
Mongo db nosql (1)
Ad

Recently uploaded (20)

PDF
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PPT
Teaching material agriculture food technology
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PDF
Machine learning based COVID-19 study performance prediction
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Electronic commerce courselecture one. Pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
MYSQL Presentation for SQL database connectivity
Teaching material agriculture food technology
GamePlan Trading System Review: Professional Trader's Honest Take
Machine learning based COVID-19 study performance prediction
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
The AUB Centre for AI in Media Proposal.docx
20250228 LYD VKU AI Blended-Learning.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
The Rise and Fall of 3GPP – Time for a Sabbatical?
Unlocking AI with Model Context Protocol (MCP)
Spectral efficient network and resource selection model in 5G networks
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Electronic commerce courselecture one. Pdf
Empathic Computing: Creating Shared Understanding
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Understanding_Digital_Forensics_Presentation.pptx
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
Per capita expenditure prediction using model stacking based on satellite ima...

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