SlideShare a Scribd company logo
1 of 20
for Beginners
ABSTRACT
 This PPT will explain about the MONGODB concepts and using that can
achieve the CURD Operation.
What is MongoDB
 It is a Open source cross platform document oriented with the scalability
and flexible database.
 MongoDB is a distributed database at its core, so high availability,
horizontal scaling, and geographic distribution are built in and easy to use.
 Its Classified as NOSQL database program.
 There is no RDBMS Concept here and data’s are stored in a flat file system.
 MongoDB uses JSON-like documents with SCHEMA for creating a new
Table in the DB. 
Key Features:
 High Performance:
 Support for embedded data models reduces I/O activity on database system.
 Indexes support faster queries and can include keys from embedded documents and
arrays.
 Rich Query Language.
 High Availability: Automatic failover and data redundancy.
 Horizontal Scalability :
 Sharding distributes data across a cluster of machines.
 MongoDB 3.4 supports creating zones of data based on the shard key. In a balanced
cluster, MongoDB directs reads and writes covered by a zone only to those shards inside
the zone. See the Zones manual page for more information.
 Support for Multiple Storage Engines:
 WiredTiger Storage Engine
 MMAPV1 Storage Engine
 Creating dummy Collection
Example :
export var dummytable= new Mongo.Collection(null);
Where we use the MongoDB
 You need High Availability in an Unreliable Environment (Cloud and Real
Life)
 You need to Grow Big (and Shard Your Data)
 Your Data is Location Based
 Your Data Set is Going to be Big (starting from 1GB) and Schema is Not
Stable
 You Don't have a DBA
Comparison Between MYSQL and
MONGODB
List Of Companies Using MongoDB
Installation Steps for MongoDB
 It will support all Operating System. The below links will used for install the
mongoDB
https://docs.mongodb.com/manual/installation/
https://www.mongodb.com/
CREATE A NEW TABLE
 We have a create a new table in MongoDB using Schema.
 In that Schema it self we can add fields and there properties of the table.
 Sample Schema for create a new table in Mongo DB. File name eg :
SampleDB.js
var sampletable= new SimpleSchema({
id: {
type: Number,
label: "ID",
optional: true //It mean the field is Mandatory
},
name: {
type: String,
label: "Name",
optional: true
},
bloodgroup: {
type: String,
label: "BloodGroup",
},
phonenumber: {
type: Number,
label: "Phone Number",
optional: true
},
Date: {
type: Date,
label: "Phone Number",
optional: true
},
});
export const Test = new Mongo.Collection('test');
Test.attachSchema(sampletable);
STORE THE VALUE
 We can store the Value in MongoDB , using INSERT command.
 If we pass a array we can store in to Database.
 The below example contains both array and list the fields are passing to
store the value in Database.
Example : Array value is storing in DB
test.insert({
id: 12345,
name: ’Kesavan’,
bloodgroup:’o+ve’,
phonenumber:’9942591686’,
date:’20180707’
});
QUERY THE RECORD
 To read or query the record in the MongoDB , here its named as finding the record .
 We have to use find(), fetch(), count() and findAll() methods for search the value in
the table.
 find() : It will find the particular record for that we have to pass the _id unique
address of the record.
 fetch() : It will fetch the value for a particular record that we have to pass the _id
unique address of the record.
 count() : It will query the records based on the counts.
 Syntax:
find() and fetch()
db.collection_name.find({ObjectId(12 digit hashcode)}).fetch();
find() and count()
db.collection_name.find({ObjectId(12 digit hashcode)}).count();
Example:
db.test.find({ObjectId(7df78ad8902c)}).fetch()
db.test.find({ObjectId(7df78ad8902c)}).count()
findAll(): we will get all the records in the collection.
Syntax:
db.collection_name.findAll({ });
Example:
db.test.findAll({ }) ;
UPDATE THE VALUE
 For Update the existing record in the MongoDB , we have to use UPDATE
command .
 We can able to update group of record as well as particular record.
 Syntax:
db.collection_name.update({ _id:’value’,fieldname:fieldvalue });
 Example:
test.update({ _id: 7df78ad8902c,phonenumber:’+91-8825719818’})
REMOVE (or)DELETE THE RECORD
 To delete the records in the collection will use REMOVE and DELETE command.
REMOVE:
 It will remove single or multiple the records in the collection the details as below.
 SYNTAX:
db.collection_name.remove({_id});
 To remove the multiple records in the collection use the below logic.
Logic:
var noofrecord= db.collection_name.find().count();
for (i=0;i< noofrecord;i++){
var idval= i._id
db.collection_name.remove({idval});
}
DELETE:
It will delete single or multiple record in the collection the details as mentioned the below.
SYNTAX:
 Delete a single record in the collection.
db.collection_name.deleteOne({_id:ObjectId(“12 digit hash”)});
Example:
db.test.deleteOne({_id:ObjectId(“838383837312”)});
 Delete multiple records in the collection.
db.collection_name.deleteMany({fieldname:fieldvalue)});
Example:
db.test.deleteMany({bloodgroup:’0+ve’)});
DROP THE TABLE
 Using the drop() predefined method will able to delete the entire
collection.
 The below example is explaining about the delete the collection.
 Example:
test.drop()
REFERENCE
 https://www.mongodb.com/
 https://www.meteor.com/tutorials/blaze/collections
 http://meteortips.com/first-meteor-tutorial/databases-part-1/
Note: Based on the mongoDB version lot of methods and functions are
released to get all the updates refer the above links.

More Related Content

What's hot

Superficial mongo db
Superficial mongo dbSuperficial mongo db
Superficial mongo db
DaeMyung Kang
 

What's hot (19)

Mongodb Introduction
Mongodb IntroductionMongodb Introduction
Mongodb Introduction
 
Superficial mongo db
Superficial mongo dbSuperficial mongo db
Superficial mongo db
 
Full metal mongo
Full metal mongoFull metal mongo
Full metal mongo
 
MongoDB
MongoDBMongoDB
MongoDB
 
2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introduction2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introduction
 
Mongo db
Mongo dbMongo db
Mongo db
 
Mongo DB 102
Mongo DB 102Mongo DB 102
Mongo DB 102
 
New Features in Apache Pinot
New Features in Apache PinotNew Features in Apache Pinot
New Features in Apache Pinot
 
Mongo indexes
Mongo indexesMongo indexes
Mongo indexes
 
MongoDB crud
MongoDB crudMongoDB crud
MongoDB crud
 
Get expertise with mongo db
Get expertise with mongo dbGet expertise with mongo db
Get expertise with mongo db
 
Mongo db basics
Mongo db basicsMongo db basics
Mongo db basics
 
Mongo db
Mongo dbMongo db
Mongo db
 
MongoDB
MongoDBMongoDB
MongoDB
 
Mongo DB
Mongo DBMongo DB
Mongo DB
 
Tag based sharding presentation
Tag based sharding presentationTag based sharding presentation
Tag based sharding presentation
 
MongoDB NYC Python
MongoDB NYC PythonMongoDB NYC Python
MongoDB NYC Python
 
An introduction to MongoDB
An introduction to MongoDBAn introduction to MongoDB
An introduction to MongoDB
 
MongoDb - Details on the POC
MongoDb - Details on the POCMongoDb - Details on the POC
MongoDb - Details on the POC
 

Similar to MongoDB

Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)
Kai Zhao
 

Similar to MongoDB (20)

Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introduction
 
Mongodb By Vipin
Mongodb By VipinMongodb By Vipin
Mongodb By Vipin
 
Mongo db
Mongo dbMongo db
Mongo db
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB
 
Node js crash course session 5
Node js crash course   session 5Node js crash course   session 5
Node js crash course session 5
 
fard car.pptx
fard car.pptxfard car.pptx
fard car.pptx
 
Query Optimization in MongoDB
Query Optimization in MongoDBQuery Optimization in MongoDB
Query Optimization in MongoDB
 
MongoDB
MongoDBMongoDB
MongoDB
 
MongoDB-presentation.pptx
MongoDB-presentation.pptxMongoDB-presentation.pptx
MongoDB-presentation.pptx
 
Introduction to MongoDB.pptx
Introduction to MongoDB.pptxIntroduction to MongoDB.pptx
Introduction to MongoDB.pptx
 
mongo.pptx
mongo.pptxmongo.pptx
mongo.pptx
 
Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)
 
NOSQL and MongoDB Database
NOSQL and MongoDB DatabaseNOSQL and MongoDB Database
NOSQL and MongoDB Database
 
Mongo db Quick Guide
Mongo db Quick GuideMongo db Quick Guide
Mongo db Quick Guide
 
DBVersity MongoDB Online Training Presentations
DBVersity MongoDB Online Training PresentationsDBVersity MongoDB Online Training Presentations
DBVersity MongoDB Online Training Presentations
 
Mongodb - NoSql Database
Mongodb - NoSql DatabaseMongodb - NoSql Database
Mongodb - NoSql Database
 
MongoDB installation,CRUD operation & JavaScript shell
MongoDB installation,CRUD operation & JavaScript shellMongoDB installation,CRUD operation & JavaScript shell
MongoDB installation,CRUD operation & JavaScript shell
 
MongoDB .local London 2019: Fast Machine Learning Development with MongoDB
MongoDB .local London 2019: Fast Machine Learning Development with MongoDBMongoDB .local London 2019: Fast Machine Learning Development with MongoDB
MongoDB .local London 2019: Fast Machine Learning Development with MongoDB
 
MongoDB .local London 2019: Fast Machine Learning Development with MongoDB
MongoDB .local London 2019: Fast Machine Learning Development with MongoDBMongoDB .local London 2019: Fast Machine Learning Development with MongoDB
MongoDB .local London 2019: Fast Machine Learning Development with MongoDB
 

Recently uploaded

Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Recently uploaded (20)

psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 

MongoDB

  • 2. ABSTRACT  This PPT will explain about the MONGODB concepts and using that can achieve the CURD Operation.
  • 3. What is MongoDB  It is a Open source cross platform document oriented with the scalability and flexible database.  MongoDB is a distributed database at its core, so high availability, horizontal scaling, and geographic distribution are built in and easy to use.  Its Classified as NOSQL database program.  There is no RDBMS Concept here and data’s are stored in a flat file system.  MongoDB uses JSON-like documents with SCHEMA for creating a new Table in the DB. 
  • 4. Key Features:  High Performance:  Support for embedded data models reduces I/O activity on database system.  Indexes support faster queries and can include keys from embedded documents and arrays.  Rich Query Language.  High Availability: Automatic failover and data redundancy.  Horizontal Scalability :  Sharding distributes data across a cluster of machines.  MongoDB 3.4 supports creating zones of data based on the shard key. In a balanced cluster, MongoDB directs reads and writes covered by a zone only to those shards inside the zone. See the Zones manual page for more information.
  • 5.  Support for Multiple Storage Engines:  WiredTiger Storage Engine  MMAPV1 Storage Engine  Creating dummy Collection Example : export var dummytable= new Mongo.Collection(null);
  • 6. Where we use the MongoDB  You need High Availability in an Unreliable Environment (Cloud and Real Life)  You need to Grow Big (and Shard Your Data)  Your Data is Location Based  Your Data Set is Going to be Big (starting from 1GB) and Schema is Not Stable  You Don't have a DBA
  • 8. List Of Companies Using MongoDB
  • 9. Installation Steps for MongoDB  It will support all Operating System. The below links will used for install the mongoDB https://docs.mongodb.com/manual/installation/ https://www.mongodb.com/
  • 10. CREATE A NEW TABLE  We have a create a new table in MongoDB using Schema.  In that Schema it self we can add fields and there properties of the table.  Sample Schema for create a new table in Mongo DB. File name eg : SampleDB.js
  • 11. var sampletable= new SimpleSchema({ id: { type: Number, label: "ID", optional: true //It mean the field is Mandatory }, name: { type: String, label: "Name", optional: true }, bloodgroup: { type: String, label: "BloodGroup", }, phonenumber: { type: Number, label: "Phone Number", optional: true }, Date: { type: Date, label: "Phone Number", optional: true }, }); export const Test = new Mongo.Collection('test'); Test.attachSchema(sampletable);
  • 12. STORE THE VALUE  We can store the Value in MongoDB , using INSERT command.  If we pass a array we can store in to Database.  The below example contains both array and list the fields are passing to store the value in Database. Example : Array value is storing in DB
  • 14. QUERY THE RECORD  To read or query the record in the MongoDB , here its named as finding the record .  We have to use find(), fetch(), count() and findAll() methods for search the value in the table.  find() : It will find the particular record for that we have to pass the _id unique address of the record.  fetch() : It will fetch the value for a particular record that we have to pass the _id unique address of the record.  count() : It will query the records based on the counts.  Syntax: find() and fetch() db.collection_name.find({ObjectId(12 digit hashcode)}).fetch(); find() and count() db.collection_name.find({ObjectId(12 digit hashcode)}).count();
  • 15. Example: db.test.find({ObjectId(7df78ad8902c)}).fetch() db.test.find({ObjectId(7df78ad8902c)}).count() findAll(): we will get all the records in the collection. Syntax: db.collection_name.findAll({ }); Example: db.test.findAll({ }) ;
  • 16. UPDATE THE VALUE  For Update the existing record in the MongoDB , we have to use UPDATE command .  We can able to update group of record as well as particular record.  Syntax: db.collection_name.update({ _id:’value’,fieldname:fieldvalue });  Example: test.update({ _id: 7df78ad8902c,phonenumber:’+91-8825719818’})
  • 17. REMOVE (or)DELETE THE RECORD  To delete the records in the collection will use REMOVE and DELETE command. REMOVE:  It will remove single or multiple the records in the collection the details as below.  SYNTAX: db.collection_name.remove({_id});  To remove the multiple records in the collection use the below logic. Logic: var noofrecord= db.collection_name.find().count(); for (i=0;i< noofrecord;i++){ var idval= i._id db.collection_name.remove({idval}); }
  • 18. DELETE: It will delete single or multiple record in the collection the details as mentioned the below. SYNTAX:  Delete a single record in the collection. db.collection_name.deleteOne({_id:ObjectId(“12 digit hash”)}); Example: db.test.deleteOne({_id:ObjectId(“838383837312”)});  Delete multiple records in the collection. db.collection_name.deleteMany({fieldname:fieldvalue)}); Example: db.test.deleteMany({bloodgroup:’0+ve’)});
  • 19. DROP THE TABLE  Using the drop() predefined method will able to delete the entire collection.  The below example is explaining about the delete the collection.  Example: test.drop()
  • 20. REFERENCE  https://www.mongodb.com/  https://www.meteor.com/tutorials/blaze/collections  http://meteortips.com/first-meteor-tutorial/databases-part-1/ Note: Based on the mongoDB version lot of methods and functions are released to get all the updates refer the above links.