SlideShare une entreprise Scribd logo
1  sur  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.

Contenu connexe

Tendances (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
 

Similaire à MongoDB CRUD Operations for Beginners

MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introductionsethfloydjr
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB Habilelabs
 
Introduction to MongoDB.pptx
Introduction to MongoDB.pptxIntroduction to MongoDB.pptx
Introduction to MongoDB.pptxSurya937648
 
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 DatabaseTariqul islam
 
Mongo db Quick Guide
Mongo db Quick GuideMongo db Quick Guide
Mongo db Quick GuideSourabh Sahu
 
DBVersity MongoDB Online Training Presentations
DBVersity MongoDB Online Training PresentationsDBVersity MongoDB Online Training Presentations
DBVersity MongoDB Online Training PresentationsSrinivas Mutyala
 
Mongodb - NoSql Database
Mongodb - NoSql DatabaseMongodb - NoSql Database
Mongodb - NoSql DatabasePrashant Gupta
 
MongoDB installation,CRUD operation & JavaScript shell
MongoDB installation,CRUD operation & JavaScript shellMongoDB installation,CRUD operation & JavaScript shell
MongoDB installation,CRUD operation & JavaScript shellShahDhruv21
 
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 MongoDBLisa Roth, PMP
 
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 MongoDBMongoDB
 

Similaire à MongoDB CRUD Operations for Beginners (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
 

Dernier

Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
ARTERIAL BLOOD GAS ANALYSIS........pptx
ARTERIAL BLOOD  GAS ANALYSIS........pptxARTERIAL BLOOD  GAS ANALYSIS........pptx
ARTERIAL BLOOD GAS ANALYSIS........pptxAneriPatwari
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
CHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptxCHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptxAneriPatwari
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Association for Project Management
 
Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17Celine George
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQuiz Club NITW
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17Celine George
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Developmentchesterberbo7
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 

Dernier (20)

Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 
ARTERIAL BLOOD GAS ANALYSIS........pptx
ARTERIAL BLOOD  GAS ANALYSIS........pptxARTERIAL BLOOD  GAS ANALYSIS........pptx
ARTERIAL BLOOD GAS ANALYSIS........pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
CHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptxCHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptx
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
 
Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Development
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 

MongoDB CRUD Operations for Beginners

  • 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.