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

Mongodb Introduction
Mongodb IntroductionMongodb Introduction
Mongodb Introduction
Raghvendra Parashar
 
Superficial mongo db
Superficial mongo dbSuperficial mongo db
Superficial mongo dbDaeMyung Kang
 
Full metal mongo
Full metal mongoFull metal mongo
Full metal mongo
Israel Gutiérrez
 
MongoDB
MongoDBMongoDB
2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introduction2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introduction
antoinegirbal
 
Mongo DB 102
Mongo DB 102Mongo DB 102
Mongo DB 102
Abhijeet Vaikar
 
New Features in Apache Pinot
New Features in Apache PinotNew Features in Apache Pinot
New Features in Apache Pinot
Siddharth Teotia
 
Mongo indexes
Mongo indexesMongo indexes
Mongo indexes
paradokslabs
 
MongoDB crud
MongoDB crudMongoDB crud
MongoDB crud
Darshan Jayarama
 
Get expertise with mongo db
Get expertise with mongo dbGet expertise with mongo db
Get expertise with mongo db
Amit Thakkar
 
Mongo db basics
Mongo db basicsMongo db basics
Mongo db basics
Claudio Montoya
 
Mongo db
Mongo dbMongo db
Mongo DB
Mongo DBMongo DB
Tag based sharding presentation
Tag based sharding presentationTag based sharding presentation
Tag based sharding presentation
Juan Antonio Roy Couto
 
MongoDB NYC Python
MongoDB NYC PythonMongoDB NYC Python
MongoDB NYC Python
Mike Dirolf
 
An introduction to MongoDB
An introduction to MongoDBAn introduction to MongoDB
An introduction to MongoDB
Universidade de São Paulo
 

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

Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
S.Shayan Daneshvar
 
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introduction
sethfloydjr
 
Mongodb By Vipin
Mongodb By VipinMongodb By Vipin
Mongodb By Vipin
Vipin Mundayad
 
Mongo db
Mongo dbMongo db
Mongo db
Gyanendra Yadav
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB
Habilelabs
 
Node js crash course session 5
Node js crash course   session 5Node js crash course   session 5
Node js crash course session 5
Abdul Rahman Masri Attal
 
fard car.pptx
fard car.pptxfard car.pptx
fard car.pptx
tarungupta276841
 
Query Optimization in MongoDB
Query Optimization in MongoDBQuery Optimization in MongoDB
Query Optimization in MongoDB
Hamoon Mohammadian Pour
 
MongoDB
MongoDBMongoDB
MongoDB
wiTTyMinds1
 
MongoDB-presentation.pptx
MongoDB-presentation.pptxMongoDB-presentation.pptx
MongoDB-presentation.pptx
tarungupta276841
 
Introduction to MongoDB.pptx
Introduction to MongoDB.pptxIntroduction to MongoDB.pptx
Introduction to MongoDB.pptx
Surya937648
 
mongo.pptx
mongo.pptxmongo.pptx
mongo.pptx
tarungupta276841
 
Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)Kai Zhao
 
NOSQL and MongoDB Database
NOSQL and MongoDB DatabaseNOSQL and MongoDB Database
NOSQL and MongoDB Database
Tariqul islam
 
Mongo db Quick Guide
Mongo db Quick GuideMongo db Quick Guide
Mongo db Quick Guide
Sourabh Sahu
 
DBVersity MongoDB Online Training Presentations
DBVersity MongoDB Online Training PresentationsDBVersity MongoDB Online Training Presentations
DBVersity MongoDB Online Training Presentations
Srinivas Mutyala
 
Mongodb - NoSql Database
Mongodb - NoSql DatabaseMongodb - NoSql Database
Mongodb - NoSql Database
Prashant Gupta
 
MongoDB installation,CRUD operation & JavaScript shell
MongoDB installation,CRUD operation & JavaScript shellMongoDB installation,CRUD operation & JavaScript shell
MongoDB installation,CRUD operation & JavaScript shell
ShahDhruv21
 
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
 
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
Lisa Roth, PMP
 

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

Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 

Recently uploaded (20)

Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 

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.