SlideShare a Scribd company logo
Introduction to MongoDB
 GDG Organizer
 Google DSC Lead
 Web & App Developer
Presented by Elie Hannouch
 What is a database ?
 What is a NoSQL database
 What is MongoDB
 Advantages of MongoDB
 MongoDB server setup
 MongoDB CRUD operations
 Cloud DBaaS via MongoDB Atlas
Agenda
A database is an organized collection of structured information, or data,
typically stored electronically in a computer system. Where these data can then
be easily accessed, managed, modified, updated, controlled, and organized.
For example, a company database may include collections for products,
employees, and financial documents. Each of these collections would have
different documents that are relevant to the information stored in the
Collection.
What is a database ?
What is a NoSQL database, and when should be used ?
● NoSQL databases are non-tabular databases and store data differently than
relational tables. NoSQL databases come in a variety of types based on their
data model like the document-based databases. They provide flexible
schemas and scale easily with large amounts of data and high user loads.
● When deciding which database to use, decision-makers typically find one or
more of the following factors lead them to selecting a NoSQL database:
-- Fast-paced Agile development
-- Huge volumes of data
-- Requirements for scale-out architecture
-- Modern application patterns like microservices
MongoDB is an open-source document-oriented database that is designed to
store a large scale of data and allows you to work with that data very
efficiently. It is categorized under the NoSQL (Not only SQL) database because
the storage and retrieval of data in the MongoDB are not in the form of tables.
It also provides official driver support for all the popular languages like C, C++,
C#, and .NET, Go, Java, Node.js, Perl, PHP, Python, Motor, Ruby, Scala,
Swift. So, that you can create an application using any of these languages.
What is MongoDB ?
Introduction To MongoDB
● It is a schema-less NoSQL database. You need not
to design the schema of the database when you are
working with MongoDB.
● It is a document-oriented database, and the data is
stored in BSON documents.
● Code-native data access ( it can be accessed from
any language, in data structures that are native to that
language (e.g., dictionaries in Python, arrays in
JavaScript, Maps in Java, etc.) )
Advantages of MongoDB
● Navigate to: https://www.mongodb.com/try/download/community
● Install the suitable version with your operating system
Setup of local MongoDB Server
● mongo : used to navigate to the mongo shell through the cmd or any
other terminal
● use dbname : used create a new local database or navigate to an existing
one
● show dbs : used to list all available databases in the localhost
● show collections: used to list all available collections in the current
database
● db.createCollection(‘collectionName’): used to create a new collection
with the provided name
● db.dropDatabase(): used to drop a database
Some Basic operations locally !!
● Create operation is used to create a document. A document is directly inserted
into the collection by using insertOne() and insertMany() methods.
● Syntax:
o db.collection-name.insertOne({field1 : value1, field2 : value2 , ....})
o db.collection-name.insertMany([{field1: value1, field2 : value2},
{field1: value1, field2 : value2, field3 : value3},{...},....])
 The benefit of mongo here is we can add extra fields or less as we insert
documents in the collection
Create Documents
● Read operation is used to retrieve documents from a
collection. MongoDB provides find(), findOne(), method
to retrieve data.
 db.collection.find(query, projection): this method
has two parameters. The first parameter is the query
and the second is the projection. If no parameter is
given, it will retrieve every document in a collection.
 Example:
db.users.find({"address":"jbeil"},{address:0}).pretty()
Read Documents
● db.collection.findOne(query, projection): Returns one document that
satisfies the specified query criteria on the collection. If multiple documents
satisfy the query, this method returns the first document according to
the natural order which reflects the order of documents on the disk
● Example: db.users.findOne({”field":”value"})
● We can also use aggregate in our query in find() like $lt , $lte , $gt , $gte , $eq ,
$or , $and , $in , $nin , $exists.
1. db.instructors.find({age:{$lt:32}})
2. db.instructors.find({age:{$gt:24}})
3. db.instructors.find({age:{$eq:21}})
4. db.instructors.find({$or: [{age:{$gt:20}}, {firstname: ”jenny"}]}, {firstname:1})
Reading & Querying Documents -- cont
● db.instructors.find( { firstname: { $in: [ "steve", "ayla" ] } } )
● db.instructors.find( { age: { $nin: [ 25, 32 ] } } )
● db.students.find( { bloodtype: { $exists: true} } )
Querying Documents - continue
● MongoDB database provides two methods for update
operations, updateOne() and updateMany(). It has three
parameters. The first parameter is the filter(condition), the
second one is the update itself while the third one consists
of few options. The third parameter is optional.
● Syntax:
db.collection.updateOne({“field” : “value”} , {$set : {“field1” : “value”}})
db.collection.updateOne({“field" : "value"}, { $set : { “field1" :"value"}},
{upsert : true})
db.collection.updateMany({”field":”value"},{$set:{”newfield":”value"}})
Updating Documents
● As the name suggests, Delete operation is used to delete documents from a
collection. There are two method for delete operation, deleteOne() and
deleteMany().
● Syntax:
1. db.collection-name.deleteOne({“field" : "value"})
2. db.collection-name.deleteMany({“field" : "value"})
● A deleteMany() with no arguments means to delete all documents in the
collection.
Delete Documents
● Database-as-a-Service (DBaaS) is a service that allows you to set up, deploy,
and scale a database without worrying about on-premise physical hardware,
software updates, and the details of configuring for performance. With
DBaaS, a cloud provider does all that for you—and gets you up and running
right away.
● MongoDB Atlas is a fully-managed cloud database that handles all the
complexity of deploying, managing, and healing your deployments on the
cloud service provider of your choice (AWS , Azure, and GCP). MongoDB Atlas
is the best way to deploy, run, and scale MongoDB in the cloud. With Atlas,
you’ll have a MongoDB database running with just a few clicks, and in just a
few minutes.
Cloud DBaaS via MongoDB Atlas
● Create your free atlas account by clicking the following link:
https://www.mongodb.com/cloud/atlas/register
Atlas - continue
THANK YOU !!

More Related Content

What's hot (20)

PPTX
NoSQL and MongoDB Introdction
Brian Enochson
 
PDF
MongoDB World 2019: Raiders of the Anti-patterns: A Journey Towards Fixing Sc...
MongoDB
 
PDF
MongoDB World 2019: Finding the Right MongoDB Atlas Cluster Size: Does This I...
MongoDB
 
PPTX
Agility and Scalability with MongoDB
MongoDB
 
PPTX
The Basics of MongoDB
valuebound
 
PPTX
MongoDB
nikhil2807
 
PPTX
Mongodb basics and architecture
Bishal Khanal
 
PDF
Mongo DB
Edureka!
 
PDF
From RDBMS to MongoDB
MongoDB
 
PPTX
MongoDB: An Introduction - june-2011
Chris Westin
 
PPTX
Mongodb introduction and_internal(simple)
Kai Zhao
 
PPTX
Benefits of Using MongoDB Over RDBMSs
MongoDB
 
PDF
Mongo db dhruba
Dhrubaji Mandal ♛
 
PDF
Apache CouchDB
Trinh Phuc Tho
 
PPT
Introduction to MongoDB
Ravi Teja
 
PPT
MongoDB Pros and Cons
johnrjenson
 
PPTX
Transitioning from SQL to MongoDB
MongoDB
 
PDF
Migrating from RDBMS to MongoDB
MongoDB
 
PPTX
A Presentation on MongoDB Introduction - Habilelabs
HabileLabs
 
PPTX
An Introduction To NoSQL & MongoDB
Lee Theobald
 
NoSQL and MongoDB Introdction
Brian Enochson
 
MongoDB World 2019: Raiders of the Anti-patterns: A Journey Towards Fixing Sc...
MongoDB
 
MongoDB World 2019: Finding the Right MongoDB Atlas Cluster Size: Does This I...
MongoDB
 
Agility and Scalability with MongoDB
MongoDB
 
The Basics of MongoDB
valuebound
 
MongoDB
nikhil2807
 
Mongodb basics and architecture
Bishal Khanal
 
Mongo DB
Edureka!
 
From RDBMS to MongoDB
MongoDB
 
MongoDB: An Introduction - june-2011
Chris Westin
 
Mongodb introduction and_internal(simple)
Kai Zhao
 
Benefits of Using MongoDB Over RDBMSs
MongoDB
 
Mongo db dhruba
Dhrubaji Mandal ♛
 
Apache CouchDB
Trinh Phuc Tho
 
Introduction to MongoDB
Ravi Teja
 
MongoDB Pros and Cons
johnrjenson
 
Transitioning from SQL to MongoDB
MongoDB
 
Migrating from RDBMS to MongoDB
MongoDB
 
A Presentation on MongoDB Introduction - Habilelabs
HabileLabs
 
An Introduction To NoSQL & MongoDB
Lee Theobald
 

Similar to Introduction To MongoDB (20)

PDF
MongoDB
wiTTyMinds1
 
PPTX
MongoDB - An Introduction
dinkar thakur
 
PPTX
Introduction to MongoDB
Raghunath A
 
PDF
Introduction to mongo db
Lawrence Mwai
 
PPTX
introtomongodb
saikiran
 
PPTX
MongoDB Introduction and Data Modelling
Sachin Bhosale
 
PPTX
MongoDB installation,CRUD operation & JavaScript shell
ShahDhruv21
 
PPTX
Mongo db
Gyanendra Yadav
 
PPTX
MongoDB_ppt.pptx
1AP18CS037ShirishKul
 
PPT
Mongo db basics
Dhaval Mistry
 
PPTX
Analytical data processing
Polad Saruxanov
 
PPTX
MongoDB using Grails plugin by puneet behl
TO THE NEW | Technology
 
PPTX
How to learn MongoDB for beginner's
surajkumartpoint
 
PPTX
Introduction to MongoDB – A NoSQL Database
manikgupta2k04
 
PDF
MongoDB NoSQL database a deep dive -MyWhitePaper
Rajesh Kumar
 
PDF
Introduction to MongoDB and its best practices
AshishRathore72
 
PDF
Mdb dn 2016_06_query_primer
Daniel M. Farrell
 
PPTX
Introduction to MongoDB.pptx
Surya937648
 
PDF
Mongodb
Thiago Veiga
 
PDF
Using MongoDB and Python
Mike Bright
 
MongoDB
wiTTyMinds1
 
MongoDB - An Introduction
dinkar thakur
 
Introduction to MongoDB
Raghunath A
 
Introduction to mongo db
Lawrence Mwai
 
introtomongodb
saikiran
 
MongoDB Introduction and Data Modelling
Sachin Bhosale
 
MongoDB installation,CRUD operation & JavaScript shell
ShahDhruv21
 
Mongo db
Gyanendra Yadav
 
MongoDB_ppt.pptx
1AP18CS037ShirishKul
 
Mongo db basics
Dhaval Mistry
 
Analytical data processing
Polad Saruxanov
 
MongoDB using Grails plugin by puneet behl
TO THE NEW | Technology
 
How to learn MongoDB for beginner's
surajkumartpoint
 
Introduction to MongoDB – A NoSQL Database
manikgupta2k04
 
MongoDB NoSQL database a deep dive -MyWhitePaper
Rajesh Kumar
 
Introduction to MongoDB and its best practices
AshishRathore72
 
Mdb dn 2016_06_query_primer
Daniel M. Farrell
 
Introduction to MongoDB.pptx
Surya937648
 
Mongodb
Thiago Veiga
 
Using MongoDB and Python
Mike Bright
 
Ad

Recently uploaded (20)

PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
PPTX
Coefficient of Variance in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
PPTX
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PPTX
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PDF
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PPTX
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
PDF
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
PDF
NEW-Viral>Wondershare Filmora 14.5.18.12900 Crack Free
sherryg1122g
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PPTX
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
PDF
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
PDF
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
PDF
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
PDF
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
Coefficient of Variance in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
NEW-Viral>Wondershare Filmora 14.5.18.12900 Crack Free
sherryg1122g
 
Tally software_Introduction_Presentation
AditiBansal54083
 
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
Ad

Introduction To MongoDB

  • 1. Introduction to MongoDB  GDG Organizer  Google DSC Lead  Web & App Developer Presented by Elie Hannouch
  • 2.  What is a database ?  What is a NoSQL database  What is MongoDB  Advantages of MongoDB  MongoDB server setup  MongoDB CRUD operations  Cloud DBaaS via MongoDB Atlas Agenda
  • 3. A database is an organized collection of structured information, or data, typically stored electronically in a computer system. Where these data can then be easily accessed, managed, modified, updated, controlled, and organized. For example, a company database may include collections for products, employees, and financial documents. Each of these collections would have different documents that are relevant to the information stored in the Collection. What is a database ?
  • 4. What is a NoSQL database, and when should be used ? ● NoSQL databases are non-tabular databases and store data differently than relational tables. NoSQL databases come in a variety of types based on their data model like the document-based databases. They provide flexible schemas and scale easily with large amounts of data and high user loads. ● When deciding which database to use, decision-makers typically find one or more of the following factors lead them to selecting a NoSQL database: -- Fast-paced Agile development -- Huge volumes of data -- Requirements for scale-out architecture -- Modern application patterns like microservices
  • 5. MongoDB is an open-source document-oriented database that is designed to store a large scale of data and allows you to work with that data very efficiently. It is categorized under the NoSQL (Not only SQL) database because the storage and retrieval of data in the MongoDB are not in the form of tables. It also provides official driver support for all the popular languages like C, C++, C#, and .NET, Go, Java, Node.js, Perl, PHP, Python, Motor, Ruby, Scala, Swift. So, that you can create an application using any of these languages. What is MongoDB ?
  • 7. ● It is a schema-less NoSQL database. You need not to design the schema of the database when you are working with MongoDB. ● It is a document-oriented database, and the data is stored in BSON documents. ● Code-native data access ( it can be accessed from any language, in data structures that are native to that language (e.g., dictionaries in Python, arrays in JavaScript, Maps in Java, etc.) ) Advantages of MongoDB
  • 8. ● Navigate to: https://www.mongodb.com/try/download/community ● Install the suitable version with your operating system Setup of local MongoDB Server
  • 9. ● mongo : used to navigate to the mongo shell through the cmd or any other terminal ● use dbname : used create a new local database or navigate to an existing one ● show dbs : used to list all available databases in the localhost ● show collections: used to list all available collections in the current database ● db.createCollection(‘collectionName’): used to create a new collection with the provided name ● db.dropDatabase(): used to drop a database Some Basic operations locally !!
  • 10. ● Create operation is used to create a document. A document is directly inserted into the collection by using insertOne() and insertMany() methods. ● Syntax: o db.collection-name.insertOne({field1 : value1, field2 : value2 , ....}) o db.collection-name.insertMany([{field1: value1, field2 : value2}, {field1: value1, field2 : value2, field3 : value3},{...},....])  The benefit of mongo here is we can add extra fields or less as we insert documents in the collection Create Documents
  • 11. ● Read operation is used to retrieve documents from a collection. MongoDB provides find(), findOne(), method to retrieve data.  db.collection.find(query, projection): this method has two parameters. The first parameter is the query and the second is the projection. If no parameter is given, it will retrieve every document in a collection.  Example: db.users.find({"address":"jbeil"},{address:0}).pretty() Read Documents
  • 12. ● db.collection.findOne(query, projection): Returns one document that satisfies the specified query criteria on the collection. If multiple documents satisfy the query, this method returns the first document according to the natural order which reflects the order of documents on the disk ● Example: db.users.findOne({”field":”value"}) ● We can also use aggregate in our query in find() like $lt , $lte , $gt , $gte , $eq , $or , $and , $in , $nin , $exists. 1. db.instructors.find({age:{$lt:32}}) 2. db.instructors.find({age:{$gt:24}}) 3. db.instructors.find({age:{$eq:21}}) 4. db.instructors.find({$or: [{age:{$gt:20}}, {firstname: ”jenny"}]}, {firstname:1}) Reading & Querying Documents -- cont
  • 13. ● db.instructors.find( { firstname: { $in: [ "steve", "ayla" ] } } ) ● db.instructors.find( { age: { $nin: [ 25, 32 ] } } ) ● db.students.find( { bloodtype: { $exists: true} } ) Querying Documents - continue
  • 14. ● MongoDB database provides two methods for update operations, updateOne() and updateMany(). It has three parameters. The first parameter is the filter(condition), the second one is the update itself while the third one consists of few options. The third parameter is optional. ● Syntax: db.collection.updateOne({“field” : “value”} , {$set : {“field1” : “value”}}) db.collection.updateOne({“field" : "value"}, { $set : { “field1" :"value"}}, {upsert : true}) db.collection.updateMany({”field":”value"},{$set:{”newfield":”value"}}) Updating Documents
  • 15. ● As the name suggests, Delete operation is used to delete documents from a collection. There are two method for delete operation, deleteOne() and deleteMany(). ● Syntax: 1. db.collection-name.deleteOne({“field" : "value"}) 2. db.collection-name.deleteMany({“field" : "value"}) ● A deleteMany() with no arguments means to delete all documents in the collection. Delete Documents
  • 16. ● Database-as-a-Service (DBaaS) is a service that allows you to set up, deploy, and scale a database without worrying about on-premise physical hardware, software updates, and the details of configuring for performance. With DBaaS, a cloud provider does all that for you—and gets you up and running right away. ● MongoDB Atlas is a fully-managed cloud database that handles all the complexity of deploying, managing, and healing your deployments on the cloud service provider of your choice (AWS , Azure, and GCP). MongoDB Atlas is the best way to deploy, run, and scale MongoDB in the cloud. With Atlas, you’ll have a MongoDB database running with just a few clicks, and in just a few minutes. Cloud DBaaS via MongoDB Atlas
  • 17. ● Create your free atlas account by clicking the following link: https://www.mongodb.com/cloud/atlas/register Atlas - continue