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
PPTX
MongoDB
PPT
Introduction to MongoDB
PPTX
MongoDB presentation
PPTX
Basics of MongoDB
PPTX
An Introduction To NoSQL & MongoDB
PPT
Introduction to mongodb
PPTX
Mongodb basics and architecture
The Basics of MongoDB
MongoDB
Introduction to MongoDB
MongoDB presentation
Basics of MongoDB
An Introduction To NoSQL & MongoDB
Introduction to mongodb
Mongodb basics and architecture

What's hot (20)

PPTX
Nosql databases
PPTX
Introduction to NoSQL
PPTX
Introduction to Django
ODP
Introduction to MongoDB
PPTX
introduction to NOSQL Database
PPTX
NOSQL vs SQL
PPTX
Introduction to MongoDB and CRUD operations
PPT
Java Multithreading and Concurrency
PPT
MYSQL.ppt
PPTX
Mongodb vs mysql
PPTX
Java Server Pages(jsp)
PPTX
JSON: The Basics
PPT
JDBC – Java Database Connectivity
PDF
MongoDB Lab Manual (1).pdf used in data science
PPT
Sql server T-sql basics ppt-3
PPTX
SQL Commands
PPTX
NoSQL databases - An introduction
ZIP
NoSQL databases
PPTX
Database Connectivity in PHP
Nosql databases
Introduction to NoSQL
Introduction to Django
Introduction to MongoDB
introduction to NOSQL Database
NOSQL vs SQL
Introduction to MongoDB and CRUD operations
Java Multithreading and Concurrency
MYSQL.ppt
Mongodb vs mysql
Java Server Pages(jsp)
JSON: The Basics
JDBC – Java Database Connectivity
MongoDB Lab Manual (1).pdf used in data science
Sql server T-sql basics ppt-3
SQL Commands
NoSQL databases - An introduction
NoSQL databases
Database Connectivity in PHP
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
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Spectroscopy.pptx food analysis technology
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
cloud_computing_Infrastucture_as_cloud_p
PPTX
TLE Review Electricity (Electricity).pptx
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
August Patch Tuesday
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Machine Learning_overview_presentation.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Spectroscopy.pptx food analysis technology
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
cloud_computing_Infrastucture_as_cloud_p
TLE Review Electricity (Electricity).pptx
NewMind AI Weekly Chronicles - August'25-Week II
Assigned Numbers - 2025 - Bluetooth® Document
August Patch Tuesday
Advanced methodologies resolving dimensionality complications for autism neur...
OMC Textile Division Presentation 2021.pptx
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Programs and apps: productivity, graphics, security and other tools
Univ-Connecticut-ChatGPT-Presentaion.pdf
Empathic Computing: Creating Shared Understanding
Machine learning based COVID-19 study performance prediction
Group 1 Presentation -Planning and Decision Making .pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Spectral efficient network and resource selection model in 5G networks
Machine Learning_overview_presentation.pptx

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