SlideShare a Scribd company logo
MongoDB
Basics
Kazi Ataul Bari
What is MongoDB
MongoDB is an open-source document database
Purpose to build MongoDB
Scalability
Performance
High Availability
History of MongoDB
MongoDB began in 2007 Thanks: http://www.javatpoint.com
Terminology and Concepts
MySQL MongoDB
1. MongoDB is an open-source database developed by
MongoDB, Inc.
2. MongoDB stores data in JSON-like documents that
can vary in structure.
3. MongoDB uses dynamic schemas, meaning that
you can create records without first defining the
structure, such as the fields or the types of their
values.
1. MySQL is a popular open-source relational database
management system (RDBMS).
2. MySQL stores data in tables and uses structured
query language (SQL) for database access.
3. In MySQL, related information may be stored in
separate tables, but associated through the use of
joins.
Sources: https://www.mongodb.com/compare/mongodb-mysql
Compare
MySQL MongoDB
Sources: https://www.mongodb.com/compare/mongodb-mysql
Table Collection
Row Document
Column Field
Joins Embedded documents, linking
Are MongoDB and MySQL used together?
Many e-commerce applications use a combination of MongoDB and MySQL.
The product catalog, which includes multiple products with different attributes, is a good fit for MongoDB’s
flexible data model.
On the other hand, the checkout system, which requires complex transactions, would likely be built on
MySQL or another relational technology.
How to install MongoDB on Windows
MongoDB folder
Sources: https://www.mongodb.com/compare/mongodb-mysql
Create a Database
There is no create database command in MongoDB. Actually, MongoDB do not
provide any command to create database.
use myNewDB
db.myNewCollection1.insert( { x: 1 } )
check the database
check the database Name
>db
check the database list
>show dbs
Document Database
A record in MongoDB is a document, which is a data structure composed of field and value pairs.
MongoDB documents are similar to JSON(JavaScript Object Notation) objects.
Sources: https://www.mongodb.com/compare/mongodb-mysql
Databases and Collections
MongoDB stores in collections; the collections in databases. Collections are analogous to tables in
relational databases.
Sources: https://www.mongodb.com/compare/mongodb-mysql00
create collection
>db.createCollection("IGU")
check the created collection
>show collections
create collection automatically
>db.IGU2020.insert({"name" : "MSIT"})
>show collections
insert()
db.users.insert({name: "sue", age: 25, status: "A"})
https://docs.mongodb.com/v3.2/crud/
Create an array of documents
var AllcoursesIGU =
[
{ "city" : "AGAWAM", "loc" : [ -72.622739, 42.070206 ], "pop" : 15338, "state" :
"MA", "_id" : "01001" },
{ "city" : "CUSHMAN", "loc" : [ -72.51564999999999, 42.377017 ], "pop" : 36963,
"state" : "MA", "_id" : "01002" },
{ "city" : "BARRE", "loc" : [ -72.10835400000001, 42.409698 ], "pop" : 4546,
"state" : "MA", "_id" : "01005" },
{ "city" : "BELCHERTOWN", "loc" : [ -72.41095300000001, 42.275103 ], "pop" :
Inserts the documents
> db.igu.insert( AllcoursesIGU );
> db.igu.find()
Read Operations: find()
>db.users.find()
Comparison Query Operators
$eq Matches values that are equal to a specified value.
$gt Matches values that are greater than a specified value.
$gte Matches values that are greater than or equal to a specified value.
$lt Matches values that are less than a specified value.
$lte Matches values that are less than or equal to a specified value.
$ne Matches all values that are not equal to a specified value.
Comparison Query Operators
db.igu.find( { state: { $eq: "MA" } } )

More Related Content

What's hot

Mango Database - Web Development
Mango Database - Web DevelopmentMango Database - Web Development
Mango Database - Web Development
mssaman
 
I say NoSQL you say what
I say NoSQL you say whatI say NoSQL you say what
I say NoSQL you say what
Pratik Khasnabis
 
Mongodb basics and architecture
Mongodb basics and architectureMongodb basics and architecture
Mongodb basics and architecture
Bishal Khanal
 
MongoDB Schema Design by Examples
MongoDB Schema Design by ExamplesMongoDB Schema Design by Examples
MongoDB Schema Design by Examples
Hadi Ariawan
 
Basics of Open Data: what you need to know by Wouter Degadt & Pieter Colpaert
Basics of Open Data: what you need to know by Wouter Degadt & Pieter ColpaertBasics of Open Data: what you need to know by Wouter Degadt & Pieter Colpaert
Basics of Open Data: what you need to know by Wouter Degadt & Pieter ColpaertOpening-up.eu
 
MongoDB NoSQL - Developer Guide
MongoDB NoSQL - Developer GuideMongoDB NoSQL - Developer Guide
MongoDB NoSQL - Developer Guide
Shiv K Sah
 
Mongo db
Mongo dbMongo db
Mongo db
STIinnsbruck
 
MongoDB
MongoDBMongoDB
MongoDB
wiTTyMinds1
 
Mongo db nosql (1)
Mongo db nosql (1)Mongo db nosql (1)
Mongo db nosql (1)
Bhavesh Sarvaiya
 
11 schema design & crud
11 schema design & crud11 schema design & crud
11 schema design & crud
Ahmed Elbassel
 
Overview on NoSQL and MongoDB
Overview on NoSQL and MongoDBOverview on NoSQL and MongoDB
Overview on NoSQL and MongoDB
harithakannan
 
MongoDB Introduction, Installation & Execution
MongoDB Introduction, Installation & ExecutionMongoDB Introduction, Installation & Execution
MongoDB Introduction, Installation & Execution
iFour Technolab Pvt. Ltd.
 
Arango DB for rubyists in 10mins
Arango DB for rubyists in 10minsArango DB for rubyists in 10mins
Arango DB for rubyists in 10mins
Pivorak MeetUp
 
Starting with MongoDB
Starting with MongoDBStarting with MongoDB
Starting with MongoDB
DoThinger
 
Mongo db commands
Mongo db commandsMongo db commands
Mongo db commands
Manpreet Khurana
 
Mongo DB
Mongo DBMongo DB
GitConnect
GitConnectGitConnect
GitConnect
Akshara Chaturvedi
 
An Introduction to MongoDB
An Introduction to MongoDBAn Introduction to MongoDB
An Introduction to MongoDB
Chamodi Adikaram
 
Mongo db operations_v2
Mongo db operations_v2Mongo db operations_v2
Mongo db operations_v2
Thanabalan Sathneeganandan
 

What's hot (20)

Mango Database - Web Development
Mango Database - Web DevelopmentMango Database - Web Development
Mango Database - Web Development
 
I say NoSQL you say what
I say NoSQL you say whatI say NoSQL you say what
I say NoSQL you say what
 
Mongodb basics and architecture
Mongodb basics and architectureMongodb basics and architecture
Mongodb basics and architecture
 
MongoDB Schema Design by Examples
MongoDB Schema Design by ExamplesMongoDB Schema Design by Examples
MongoDB Schema Design by Examples
 
Basics of Open Data: what you need to know by Wouter Degadt & Pieter Colpaert
Basics of Open Data: what you need to know by Wouter Degadt & Pieter ColpaertBasics of Open Data: what you need to know by Wouter Degadt & Pieter Colpaert
Basics of Open Data: what you need to know by Wouter Degadt & Pieter Colpaert
 
MongoDB NoSQL - Developer Guide
MongoDB NoSQL - Developer GuideMongoDB NoSQL - Developer Guide
MongoDB NoSQL - Developer Guide
 
Mongo db
Mongo dbMongo db
Mongo db
 
MongoDB
MongoDBMongoDB
MongoDB
 
Mongo db nosql (1)
Mongo db nosql (1)Mongo db nosql (1)
Mongo db nosql (1)
 
18.xml
18.xml18.xml
18.xml
 
11 schema design & crud
11 schema design & crud11 schema design & crud
11 schema design & crud
 
Overview on NoSQL and MongoDB
Overview on NoSQL and MongoDBOverview on NoSQL and MongoDB
Overview on NoSQL and MongoDB
 
MongoDB Introduction, Installation & Execution
MongoDB Introduction, Installation & ExecutionMongoDB Introduction, Installation & Execution
MongoDB Introduction, Installation & Execution
 
Arango DB for rubyists in 10mins
Arango DB for rubyists in 10minsArango DB for rubyists in 10mins
Arango DB for rubyists in 10mins
 
Starting with MongoDB
Starting with MongoDBStarting with MongoDB
Starting with MongoDB
 
Mongo db commands
Mongo db commandsMongo db commands
Mongo db commands
 
Mongo DB
Mongo DBMongo DB
Mongo DB
 
GitConnect
GitConnectGitConnect
GitConnect
 
An Introduction to MongoDB
An Introduction to MongoDBAn Introduction to MongoDB
An Introduction to MongoDB
 
Mongo db operations_v2
Mongo db operations_v2Mongo db operations_v2
Mongo db operations_v2
 

Viewers also liked

Professionals Detox
Professionals DetoxProfessionals Detox
Professionals Detox
Serenity House Detox
 
Ilmu Pengetahuan Alam (tesa,cici,putri,priskila) SMP MASEHI PARAKAN
Ilmu Pengetahuan Alam (tesa,cici,putri,priskila) SMP MASEHI PARAKAN  Ilmu Pengetahuan Alam (tesa,cici,putri,priskila) SMP MASEHI PARAKAN
Ilmu Pengetahuan Alam (tesa,cici,putri,priskila) SMP MASEHI PARAKAN Tesalonika S
 
Weider Heat Pumps Presentation Showcase Dublin
Weider Heat Pumps Presentation Showcase DublinWeider Heat Pumps Presentation Showcase Dublin
Weider Heat Pumps Presentation Showcase Dublin
Weider Wärmepumpen GmbH
 
Customer Expectation and Service Excellence - Final
Customer Expectation and Service Excellence - FinalCustomer Expectation and Service Excellence - Final
Customer Expectation and Service Excellence - FinalSid Gupta
 
Self discovery
Self discoverySelf discovery
Self discovery
Aikomo Oluwanifemi
 

Viewers also liked (6)

Professionals Detox
Professionals DetoxProfessionals Detox
Professionals Detox
 
Ilmu Pengetahuan Alam (tesa,cici,putri,priskila) SMP MASEHI PARAKAN
Ilmu Pengetahuan Alam (tesa,cici,putri,priskila) SMP MASEHI PARAKAN  Ilmu Pengetahuan Alam (tesa,cici,putri,priskila) SMP MASEHI PARAKAN
Ilmu Pengetahuan Alam (tesa,cici,putri,priskila) SMP MASEHI PARAKAN
 
Weider Heat Pumps Presentation Showcase Dublin
Weider Heat Pumps Presentation Showcase DublinWeider Heat Pumps Presentation Showcase Dublin
Weider Heat Pumps Presentation Showcase Dublin
 
InspireCaseStudyPPT
InspireCaseStudyPPTInspireCaseStudyPPT
InspireCaseStudyPPT
 
Customer Expectation and Service Excellence - Final
Customer Expectation and Service Excellence - FinalCustomer Expectation and Service Excellence - Final
Customer Expectation and Service Excellence - Final
 
Self discovery
Self discoverySelf discovery
Self discovery
 

Similar to MongoDB

Mongo DB
Mongo DBMongo DB
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introduction
sethfloydjr
 
Mongo db
Mongo dbMongo db
Mongo db
Gyanendra Yadav
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
S.Shayan Daneshvar
 
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
Rajesh Kumar
 
Mongodb By Vipin
Mongodb By VipinMongodb By Vipin
Mongodb By Vipin
Vipin Mundayad
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB
Habilelabs
 
Query Optimization in MongoDB
Query Optimization in MongoDBQuery Optimization in MongoDB
Query Optimization in MongoDB
Hamoon Mohammadian Pour
 
Introduction to MongoDB.pptx
Introduction to MongoDB.pptxIntroduction to MongoDB.pptx
Introduction to MongoDB.pptx
Surya937648
 
A Study on Mongodb Database.pdf
A Study on Mongodb Database.pdfA Study on Mongodb Database.pdf
A Study on Mongodb Database.pdf
Jessica Navarro
 
A Study on Mongodb Database
A Study on Mongodb DatabaseA Study on Mongodb Database
A Study on Mongodb Database
IJSRD
 
Mongodb Introduction
Mongodb IntroductionMongodb Introduction
Mongodb Introduction
Raghvendra Parashar
 
Mongo db basics
Mongo db basicsMongo db basics
Mongo db basics
Dhaval Mistry
 
Mongodb - NoSql Database
Mongodb - NoSql DatabaseMongodb - NoSql Database
Mongodb - NoSql Database
Prashant Gupta
 
Mongo db halloween party
Mongo db halloween partyMongo db halloween party
Mongo db halloween party
Andrea Balducci
 
MongoDB presentation
MongoDB presentationMongoDB presentation
MongoDB presentation
Hyphen Call
 
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introduction
dinkar thakur
 
Mongo db basics
Mongo db basicsMongo db basics
Mongo db basics
Claudio Montoya
 
Node Js, AngularJs and Express Js Tutorial
Node Js, AngularJs and Express Js TutorialNode Js, AngularJs and Express Js Tutorial
Node Js, AngularJs and Express Js Tutorial
PHP Support
 
Top MongoDB interview Questions and Answers
Top MongoDB interview Questions and AnswersTop MongoDB interview Questions and Answers
Top MongoDB interview Questions and Answers
jeetendra mandal
 

Similar to MongoDB (20)

Mongo DB
Mongo DBMongo DB
Mongo DB
 
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introduction
 
Mongo db
Mongo dbMongo db
Mongo db
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
MongoDB NoSQL database a deep dive -MyWhitePaper
MongoDB  NoSQL database a deep dive -MyWhitePaperMongoDB  NoSQL database a deep dive -MyWhitePaper
MongoDB NoSQL database a deep dive -MyWhitePaper
 
Mongodb By Vipin
Mongodb By VipinMongodb By Vipin
Mongodb By Vipin
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB
 
Query Optimization in MongoDB
Query Optimization in MongoDBQuery Optimization in MongoDB
Query Optimization in MongoDB
 
Introduction to MongoDB.pptx
Introduction to MongoDB.pptxIntroduction to MongoDB.pptx
Introduction to MongoDB.pptx
 
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
 
Mongodb Introduction
Mongodb IntroductionMongodb Introduction
Mongodb Introduction
 
Mongo db basics
Mongo db basicsMongo db basics
Mongo db basics
 
Mongodb - NoSql Database
Mongodb - NoSql DatabaseMongodb - NoSql Database
Mongodb - NoSql Database
 
Mongo db halloween party
Mongo db halloween partyMongo db halloween party
Mongo db halloween party
 
MongoDB presentation
MongoDB presentationMongoDB presentation
MongoDB presentation
 
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introduction
 
Mongo db basics
Mongo db basicsMongo db basics
Mongo db basics
 
Node Js, AngularJs and Express Js Tutorial
Node Js, AngularJs and Express Js TutorialNode Js, AngularJs and Express Js Tutorial
Node Js, AngularJs and Express Js Tutorial
 
Top MongoDB interview Questions and Answers
Top MongoDB interview Questions and AnswersTop MongoDB interview Questions and Answers
Top MongoDB interview Questions and Answers
 

MongoDB

  • 2. What is MongoDB MongoDB is an open-source document database Purpose to build MongoDB Scalability Performance High Availability History of MongoDB MongoDB began in 2007 Thanks: http://www.javatpoint.com
  • 3. Terminology and Concepts MySQL MongoDB 1. MongoDB is an open-source database developed by MongoDB, Inc. 2. MongoDB stores data in JSON-like documents that can vary in structure. 3. MongoDB uses dynamic schemas, meaning that you can create records without first defining the structure, such as the fields or the types of their values. 1. MySQL is a popular open-source relational database management system (RDBMS). 2. MySQL stores data in tables and uses structured query language (SQL) for database access. 3. In MySQL, related information may be stored in separate tables, but associated through the use of joins. Sources: https://www.mongodb.com/compare/mongodb-mysql
  • 4. Compare MySQL MongoDB Sources: https://www.mongodb.com/compare/mongodb-mysql Table Collection Row Document Column Field Joins Embedded documents, linking
  • 5. Are MongoDB and MySQL used together? Many e-commerce applications use a combination of MongoDB and MySQL. The product catalog, which includes multiple products with different attributes, is a good fit for MongoDB’s flexible data model. On the other hand, the checkout system, which requires complex transactions, would likely be built on MySQL or another relational technology.
  • 6. How to install MongoDB on Windows
  • 9. Create a Database There is no create database command in MongoDB. Actually, MongoDB do not provide any command to create database. use myNewDB db.myNewCollection1.insert( { x: 1 } )
  • 10. check the database check the database Name >db check the database list >show dbs
  • 11. Document Database A record in MongoDB is a document, which is a data structure composed of field and value pairs. MongoDB documents are similar to JSON(JavaScript Object Notation) objects. Sources: https://www.mongodb.com/compare/mongodb-mysql
  • 12. Databases and Collections MongoDB stores in collections; the collections in databases. Collections are analogous to tables in relational databases. Sources: https://www.mongodb.com/compare/mongodb-mysql00
  • 13. create collection >db.createCollection("IGU") check the created collection >show collections
  • 15. insert() db.users.insert({name: "sue", age: 25, status: "A"}) https://docs.mongodb.com/v3.2/crud/
  • 16. Create an array of documents var AllcoursesIGU = [ { "city" : "AGAWAM", "loc" : [ -72.622739, 42.070206 ], "pop" : 15338, "state" : "MA", "_id" : "01001" }, { "city" : "CUSHMAN", "loc" : [ -72.51564999999999, 42.377017 ], "pop" : 36963, "state" : "MA", "_id" : "01002" }, { "city" : "BARRE", "loc" : [ -72.10835400000001, 42.409698 ], "pop" : 4546, "state" : "MA", "_id" : "01005" }, { "city" : "BELCHERTOWN", "loc" : [ -72.41095300000001, 42.275103 ], "pop" :
  • 17. Inserts the documents > db.igu.insert( AllcoursesIGU ); > db.igu.find()
  • 19. Comparison Query Operators $eq Matches values that are equal to a specified value. $gt Matches values that are greater than a specified value. $gte Matches values that are greater than or equal to a specified value. $lt Matches values that are less than a specified value. $lte Matches values that are less than or equal to a specified value. $ne Matches all values that are not equal to a specified value.
  • 20. Comparison Query Operators db.igu.find( { state: { $eq: "MA" } } )

Editor's Notes

  1. MongoDB tutorial provides basic and advanced concepts of SQL. Our MongoDB tutorial is designed for beginners and professionals. MongoDB is a No SQL database. It is an open-source, cross-platform, document-oriented database written in C++. Our MongoDB tutorial includes all topics of MongoDB database such as insert documents, update documents, delete documents, query documents, projection, sort() and limit() methods, create collection, drop collection etc. There are also given MongoDB interview questions to help you better understand the MongoDB database.
  2. MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling. In simple words you can say that - Mongo DB is a document oriented database. It is an open source product, developed and supported by a company named 10gen. MongoDB is available under General Public license for free and it is also available under Commercial license from the manufacture. The manufacturing company 10 gen has given the definition of Mongo DB: "Mongo DB is scalable, open source, high performance, document oriented database." - 10 gen MongoDB was designed to work with commodity servers. Now it is used by company of all sizes, across all industry. Purpose to build MongoDB This may be a very genuine question that - "what was the need of MongoDB although there were many databases in action?" This is a very simple answer: All the modern applications require big data, fast features development, flexible deployment and the older database systems not enough competent, so the MongoDB was obviously needed. Main purpose to build MongoDB: Scalability Performance High Availability Scaling from single server deployments to large, complex multi-site architectures. Key points of MongoDB Develop Faster Deploy Easier Scale Bigger