SlideShare a Scribd company logo
MEET MONGODB
MongoDB is a document-oriented database.
It is a NoSQL database, meaning it does not use a traditional relational
database structure.
MongoDB is schema-less, meaning that you do not need to define the
structure of your data in advance.
MongoDB is highly scalable and can be used to store large amounts of data.
MEET MONGODB
MongoDB can manage
Structured data
Semi structured data
Unstructured data
NoSQL Databases
No table
No row
No complex join
MEET MONGODB
Advantages
Schema less
single object
No complex joins
Deep query-ability
Tuning
Ease of scale-out
Uses internal memory for storing
Where to Use MongoDB
Big Data
Content Management and Delivery
Mobile and Social Infrastructure
User Data Management
Data Hub
BASIC TERMINOLOGY
EMBEDDED DATA MODEL
In this model, you can have (embed) all the related
data in a single document
it is also known as de-normalized data model.
NORMALIZED DATA MODEL
In this model, you can refer the sub documents in the original document.
DATATYPES
SAMPLE DOCUMENT
_id is a 12 bytes hexadecimal number
First 4 bytes = current timestamp
Next 3 bytes = machine id
Next 2 bytes = process id
Last 3 bytes = incremental VALUE
MONGODB ATLAS
MongoDB Atlas is a cloud-based database service
That makes it easy to deploy, manage, and scale
MongoDB databases
Atlas is a fully managed service, so you don't need to
worry about the underlying infrastructure
Atlas is available on a variety of cloud providers,
including AWS, Azure, and Google Cloud Platform
Download & Install MongoDB Community Server
Download & Install MongoDB Compass
Connect Compass With Server
INSTALL MONGODB ENVIRONMENT
LOOK INSIDE
MongoDB Compass
MONGODB
Dedicated VS Code Extension
LOOK INSIDE
MongoDB VS Code Extension
LETS START
MongoDB Query Writing
DATABASE RELATED METHODS
db.help()
Common db objects. Displays method descriptions
db.hostInfo()
Returns a document record containing information about the operating system MongoDB is running on.
db.getName()
Returns the name of the current database.
db.getMongo()
Returns the name of the current database.
db.currentOp()
Reports the current in-progress operations.
DATABASE RELATED METHODS
db.dropDatabase()
Removes the current database.
db.getCollectionInfos()
Returns collection information for all collections in the current database.
db.getCollectionNames()
Lists all collections in the current database.
db.getLastError()
Checks and returns the status of the last operation
db.getLastErrorObj()
Returns the status document for the last operation.
DATABASE RELATED METHODS
db.isMaster()
Returns a document object containing a status report for the replica set.
db.getReplicationInfo()
Returns statistics for a replica set.
db.listCommands()
Displays a list of common database commands.
db.logout()
Terminates an authenticated session.
db.printCollectionStats()
Display statistics for each collection.
DATABASE RELATED METHODS
db.serverBuildInfo()
Returns a mongod documentation record containing the compile parameters for the instance.
db.serverStatus()
Returns a document that provides an overview of the state of the database process.
db.shutdownServer()
Cleanly and safely stops the current mongod or mongos process.
db.stats()
Returns a document record containing a report on the current database state.
db.version()
Returns the version number of the mongod instance:
DATABASE RELATED METHODS
db.createCollection('demo')
Returns a mongod documentation record containing the compile parameters for the instance.
db.CollectionName.drop()
It completely removes a collection from the database and does not leave any indexes associated with the dropped collections
INSERT QUERY
The insertOne() method allows you
to insert a single document into a
collection.
INSERT QUERY
The insertMany() allows you to
insert multiple documents into a
collection.
FIND QUERY
The findOne() returns a single
document from a collection that
satisfies the specified condition.
The find() method finds the
documents that satisfy a specified
condition and returns a cursor to the
matching documents
PROJECTION
In MongoDB, projection means
selecting only the necessary data
rather than selecting whole of the
data of a document.
COMPARISON QUERY OPERATOR
$eq: Equal To Operator
$lt: Less Than Operator
$lte: Less Than or Equal To Operator
$gt: Greater Than Operator
$gte: Greater Than or Equal To Operator
$ne: Not Equal To Operator
$in: In Operator
$nin: Not In Operator
LOGICAL QUERY OPERATOR
$and: Logical AND Opeartor
$or: Logical OR Operator
$not: Logical NOT operation
$nor: Logical NOR operation
ELEMENT QUERY OPERATOR
$exists: Matches documents that have the specified field.
$type: Selects documents if a field is of the specified type.
ELEMENT QUERY OPERATOR
EVALUATION QUERY OPERATOR
$expr
Allows use of aggregation expressions within the query language.
$jsonSchema
Validate documents against the given JSON Schema.
$mod
Performs a modulo operation on the value of a field and selects documents with a specified result.
$regex
Selects documents where values match a specified regular expression.
$text
Performs text search.
$where
Matches documents that satisfy a JavaScript expression.
EVALUATION QUERY OPERATOR
EVALUATION QUERY OPERATOR
SORT LIMIT DISTINCT & ROW COUNT
DELETE
UPDATE ONE & MANY
INCREMENT & DECREMENT
UNSET & RENAME
UPSERT
Upsert is a combination of update and insert. Upsert performs two functions:
Update data if there is a matching document.
Insert a new document in case there is no document matches the query criteria.
MEET AGGREGATION
Allow you to process multiple documents and return the results.
To perform aggregation operations, use aggregation pipelines.
An aggregation pipeline contains one or more stages that process
the input documents.
SELECT , ROW COUNT IN AGGREGATION
SORT LIMIT IN AGGREGATION
SELECT FIRST 3 & LAST 3 AGGREGATION
CAMPARISON OPERATOR AGGREGATION
$eq: Equal To Operator
$lt: Less Than Operator
$lte: Less Than or Equal To Operator
$gt: Greater Than Operator
$gte: Greater Than or Equal To Operator
$ne: Not Equal To Operator
$in: In Operator
$nin: Not In Operator
LOGICAL OPERATOR AGGREGATION
$and: Logical AND Opeartor
$or: Logical OR Operator
$not: Logical NOT operation
$nor: Logical NOR operation
ELEMENT QUERY OPERATORS AGGREGATION
$exists: Matches documents that have the specified field.
$type: Selects documents if a field is of the specified type.
ELEMENT QUERY OPERATORS AGGREGATION
Ad

More Related Content

Similar to MongoDB.pdf54teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeer (20)

fard car.pptx
fard car.pptxfard car.pptx
fard car.pptx
tarungupta276841
 
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introduction
dinkar thakur
 
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
 
Slide perkenalan dengan dasar MongoDB-query
Slide perkenalan dengan dasar MongoDB-querySlide perkenalan dengan dasar MongoDB-query
Slide perkenalan dengan dasar MongoDB-query
amazaza49
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
S.Shayan Daneshvar
 
Getting Started with MongoDB
Getting Started with MongoDBGetting Started with MongoDB
Getting Started with MongoDB
Ahasanul Kalam Akib
 
Mongo db basics
Mongo db basicsMongo db basics
Mongo db basics
Dhaval Mistry
 
Introduction To MongoDB
Introduction To MongoDBIntroduction To MongoDB
Introduction To MongoDB
ElieHannouch
 
MongoDB Knowledge share
MongoDB Knowledge shareMongoDB Knowledge share
MongoDB Knowledge share
Mr Kyaing
 
Mongo Bb - NoSQL tutorial
Mongo Bb - NoSQL tutorialMongo Bb - NoSQL tutorial
Mongo Bb - NoSQL tutorial
Mohan Rathour
 
Superficial mongo db
Superficial mongo dbSuperficial mongo db
Superficial mongo db
DaeMyung Kang
 
Big data technology unit 3
Big data technology unit 3Big data technology unit 3
Big data technology unit 3
RojaT4
 
9 Python programming notes for ktu physics and computer application semester 4
9 Python programming notes for ktu  physics and computer application semester 49 Python programming notes for ktu  physics and computer application semester 4
9 Python programming notes for ktu physics and computer application semester 4
ebindboby1
 
Database indexing framework
Database indexing frameworkDatabase indexing framework
Database indexing framework
Nitin Pande
 
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introduction
sethfloydjr
 
Excel Database Function
Excel Database FunctionExcel Database Function
Excel Database Function
Anita Shah
 
171_74_216_Module_5-Non_relational_database_-mongodb.pptx
171_74_216_Module_5-Non_relational_database_-mongodb.pptx171_74_216_Module_5-Non_relational_database_-mongodb.pptx
171_74_216_Module_5-Non_relational_database_-mongodb.pptx
sukrithlal008
 
Mongodb Introduction
Mongodb IntroductionMongodb Introduction
Mongodb Introduction
Raghvendra Parashar
 
MongoDB_ppt.pptx
MongoDB_ppt.pptxMongoDB_ppt.pptx
MongoDB_ppt.pptx
1AP18CS037ShirishKul
 
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
 
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introduction
dinkar thakur
 
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
 
Slide perkenalan dengan dasar MongoDB-query
Slide perkenalan dengan dasar MongoDB-querySlide perkenalan dengan dasar MongoDB-query
Slide perkenalan dengan dasar MongoDB-query
amazaza49
 
Introduction To MongoDB
Introduction To MongoDBIntroduction To MongoDB
Introduction To MongoDB
ElieHannouch
 
MongoDB Knowledge share
MongoDB Knowledge shareMongoDB Knowledge share
MongoDB Knowledge share
Mr Kyaing
 
Mongo Bb - NoSQL tutorial
Mongo Bb - NoSQL tutorialMongo Bb - NoSQL tutorial
Mongo Bb - NoSQL tutorial
Mohan Rathour
 
Superficial mongo db
Superficial mongo dbSuperficial mongo db
Superficial mongo db
DaeMyung Kang
 
Big data technology unit 3
Big data technology unit 3Big data technology unit 3
Big data technology unit 3
RojaT4
 
9 Python programming notes for ktu physics and computer application semester 4
9 Python programming notes for ktu  physics and computer application semester 49 Python programming notes for ktu  physics and computer application semester 4
9 Python programming notes for ktu physics and computer application semester 4
ebindboby1
 
Database indexing framework
Database indexing frameworkDatabase indexing framework
Database indexing framework
Nitin Pande
 
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introduction
sethfloydjr
 
Excel Database Function
Excel Database FunctionExcel Database Function
Excel Database Function
Anita Shah
 
171_74_216_Module_5-Non_relational_database_-mongodb.pptx
171_74_216_Module_5-Non_relational_database_-mongodb.pptx171_74_216_Module_5-Non_relational_database_-mongodb.pptx
171_74_216_Module_5-Non_relational_database_-mongodb.pptx
sukrithlal008
 

Recently uploaded (20)

A comparative study of onlay versus sublay mesh repair in the surgical manage...
A comparative study of onlay versus sublay mesh repair in the surgical manage...A comparative study of onlay versus sublay mesh repair in the surgical manage...
A comparative study of onlay versus sublay mesh repair in the surgical manage...
Sona Thesis Consultancy
 
Information Resources In Pharmacovigilance.pptx
Information Resources In Pharmacovigilance.pptxInformation Resources In Pharmacovigilance.pptx
Information Resources In Pharmacovigilance.pptx
Dr. Koppala R.V.S. Chaitanya
 
PLEURAL EFFUSION By Dr. Kritika Somani..
PLEURAL EFFUSION By Dr. Kritika Somani..PLEURAL EFFUSION By Dr. Kritika Somani..
PLEURAL EFFUSION By Dr. Kritika Somani..
KritikaSomani1
 
Awake Craniotomy with endoscopic support, guided by intraoperative ultrasound...
Awake Craniotomy with endoscopic support, guided by intraoperative ultrasound...Awake Craniotomy with endoscopic support, guided by intraoperative ultrasound...
Awake Craniotomy with endoscopic support, guided by intraoperative ultrasound...
Dr. Damian Lastra Copello
 
Subconjunctival Hemorrhage Secondary to Pertussis.pdf
Subconjunctival Hemorrhage Secondary to Pertussis.pdfSubconjunctival Hemorrhage Secondary to Pertussis.pdf
Subconjunctival Hemorrhage Secondary to Pertussis.pdf
wahbikhalidali
 
Methods of Cancer diagnosis in Context of Radiotherapy
Methods of Cancer diagnosis in Context  of RadiotherapyMethods of Cancer diagnosis in Context  of Radiotherapy
Methods of Cancer diagnosis in Context of Radiotherapy
Saikat Roy
 
Lecture chi squire. For Postgraduate and Undergraduate
Lecture chi squire. For Postgraduate and UndergraduateLecture chi squire. For Postgraduate and Undergraduate
Lecture chi squire. For Postgraduate and Undergraduate
Tauseef Jawaid
 
WOUND HEALING IN PERIODONTOLOGY - 3.pptx
WOUND HEALING IN PERIODONTOLOGY - 3.pptxWOUND HEALING IN PERIODONTOLOGY - 3.pptx
WOUND HEALING IN PERIODONTOLOGY - 3.pptx
tarunprakash1904
 
Pharmacology All Notes 505 Slides (2).pptx
Pharmacology All Notes 505 Slides (2).pptxPharmacology All Notes 505 Slides (2).pptx
Pharmacology All Notes 505 Slides (2).pptx
ssuseraed25f1
 
Basic of ECG & Cardiac monitoring for Health Professionals.pptx
Basic of ECG & Cardiac monitoring for Health Professionals.pptxBasic of ECG & Cardiac monitoring for Health Professionals.pptx
Basic of ECG & Cardiac monitoring for Health Professionals.pptx
Asokan R
 
Defining and Delivering Person-Centric HIV Care in Key Populations
Defining and Delivering Person-Centric HIV Care in Key PopulationsDefining and Delivering Person-Centric HIV Care in Key Populations
Defining and Delivering Person-Centric HIV Care in Key Populations
PVI, PeerView Institute for Medical Education
 
HIV AIDS for university students studying
HIV AIDS for university students studyingHIV AIDS for university students studying
HIV AIDS for university students studying
arthurtheophilus56
 
The Physiology of Central Nervous System - Sensory Pathways
The Physiology of Central Nervous System - Sensory PathwaysThe Physiology of Central Nervous System - Sensory Pathways
The Physiology of Central Nervous System - Sensory Pathways
MedicoseAcademics
 
Information Resources Adverse Drug Reaction.pptx
Information Resources Adverse Drug Reaction.pptxInformation Resources Adverse Drug Reaction.pptx
Information Resources Adverse Drug Reaction.pptx
Dr. Koppala R.V.S. Chaitanya
 
Common Male Sexual Problems | Best Sexologist in Patna, Bihar | Dr. Sunil Dubey
Common Male Sexual Problems | Best Sexologist in Patna, Bihar | Dr. Sunil DubeyCommon Male Sexual Problems | Best Sexologist in Patna, Bihar | Dr. Sunil Dubey
Common Male Sexual Problems | Best Sexologist in Patna, Bihar | Dr. Sunil Dubey
Sexologist Dr. Sunil Dubey - Dubey Clinic
 
Diagnostics of Dental implant .scientific day 2025.pdf
Diagnostics of Dental implant .scientific day 2025.pdfDiagnostics of Dental implant .scientific day 2025.pdf
Diagnostics of Dental implant .scientific day 2025.pdf
Shimaa Hussein Kotb
 
BIOMECHANICS & KINESIOLOGY OF THEHIP COMPLEX.pptx
BIOMECHANICS & KINESIOLOGY OF THEHIP COMPLEX.pptxBIOMECHANICS & KINESIOLOGY OF THEHIP COMPLEX.pptx
BIOMECHANICS & KINESIOLOGY OF THEHIP COMPLEX.pptx
drnidhimnd
 
Physiology of Pain and thermal sensations
Physiology of Pain and thermal sensationsPhysiology of Pain and thermal sensations
Physiology of Pain and thermal sensations
MedicoseAcademics
 
Taking the Lead in Timely Diagnosis of AD: Incorporating Biomarkers Into Rout...
Taking the Lead in Timely Diagnosis of AD: Incorporating Biomarkers Into Rout...Taking the Lead in Timely Diagnosis of AD: Incorporating Biomarkers Into Rout...
Taking the Lead in Timely Diagnosis of AD: Incorporating Biomarkers Into Rout...
PVI, PeerView Institute for Medical Education
 
PLEURA & IT'S RECESSES -Prof.Dr.N.Mugunthan.pdf
PLEURA & IT'S RECESSES -Prof.Dr.N.Mugunthan.pdfPLEURA & IT'S RECESSES -Prof.Dr.N.Mugunthan.pdf
PLEURA & IT'S RECESSES -Prof.Dr.N.Mugunthan.pdf
Kanyakumari Medical Mission Research Center, Muttom
 
A comparative study of onlay versus sublay mesh repair in the surgical manage...
A comparative study of onlay versus sublay mesh repair in the surgical manage...A comparative study of onlay versus sublay mesh repair in the surgical manage...
A comparative study of onlay versus sublay mesh repair in the surgical manage...
Sona Thesis Consultancy
 
PLEURAL EFFUSION By Dr. Kritika Somani..
PLEURAL EFFUSION By Dr. Kritika Somani..PLEURAL EFFUSION By Dr. Kritika Somani..
PLEURAL EFFUSION By Dr. Kritika Somani..
KritikaSomani1
 
Awake Craniotomy with endoscopic support, guided by intraoperative ultrasound...
Awake Craniotomy with endoscopic support, guided by intraoperative ultrasound...Awake Craniotomy with endoscopic support, guided by intraoperative ultrasound...
Awake Craniotomy with endoscopic support, guided by intraoperative ultrasound...
Dr. Damian Lastra Copello
 
Subconjunctival Hemorrhage Secondary to Pertussis.pdf
Subconjunctival Hemorrhage Secondary to Pertussis.pdfSubconjunctival Hemorrhage Secondary to Pertussis.pdf
Subconjunctival Hemorrhage Secondary to Pertussis.pdf
wahbikhalidali
 
Methods of Cancer diagnosis in Context of Radiotherapy
Methods of Cancer diagnosis in Context  of RadiotherapyMethods of Cancer diagnosis in Context  of Radiotherapy
Methods of Cancer diagnosis in Context of Radiotherapy
Saikat Roy
 
Lecture chi squire. For Postgraduate and Undergraduate
Lecture chi squire. For Postgraduate and UndergraduateLecture chi squire. For Postgraduate and Undergraduate
Lecture chi squire. For Postgraduate and Undergraduate
Tauseef Jawaid
 
WOUND HEALING IN PERIODONTOLOGY - 3.pptx
WOUND HEALING IN PERIODONTOLOGY - 3.pptxWOUND HEALING IN PERIODONTOLOGY - 3.pptx
WOUND HEALING IN PERIODONTOLOGY - 3.pptx
tarunprakash1904
 
Pharmacology All Notes 505 Slides (2).pptx
Pharmacology All Notes 505 Slides (2).pptxPharmacology All Notes 505 Slides (2).pptx
Pharmacology All Notes 505 Slides (2).pptx
ssuseraed25f1
 
Basic of ECG & Cardiac monitoring for Health Professionals.pptx
Basic of ECG & Cardiac monitoring for Health Professionals.pptxBasic of ECG & Cardiac monitoring for Health Professionals.pptx
Basic of ECG & Cardiac monitoring for Health Professionals.pptx
Asokan R
 
HIV AIDS for university students studying
HIV AIDS for university students studyingHIV AIDS for university students studying
HIV AIDS for university students studying
arthurtheophilus56
 
The Physiology of Central Nervous System - Sensory Pathways
The Physiology of Central Nervous System - Sensory PathwaysThe Physiology of Central Nervous System - Sensory Pathways
The Physiology of Central Nervous System - Sensory Pathways
MedicoseAcademics
 
Common Male Sexual Problems | Best Sexologist in Patna, Bihar | Dr. Sunil Dubey
Common Male Sexual Problems | Best Sexologist in Patna, Bihar | Dr. Sunil DubeyCommon Male Sexual Problems | Best Sexologist in Patna, Bihar | Dr. Sunil Dubey
Common Male Sexual Problems | Best Sexologist in Patna, Bihar | Dr. Sunil Dubey
Sexologist Dr. Sunil Dubey - Dubey Clinic
 
Diagnostics of Dental implant .scientific day 2025.pdf
Diagnostics of Dental implant .scientific day 2025.pdfDiagnostics of Dental implant .scientific day 2025.pdf
Diagnostics of Dental implant .scientific day 2025.pdf
Shimaa Hussein Kotb
 
BIOMECHANICS & KINESIOLOGY OF THEHIP COMPLEX.pptx
BIOMECHANICS & KINESIOLOGY OF THEHIP COMPLEX.pptxBIOMECHANICS & KINESIOLOGY OF THEHIP COMPLEX.pptx
BIOMECHANICS & KINESIOLOGY OF THEHIP COMPLEX.pptx
drnidhimnd
 
Physiology of Pain and thermal sensations
Physiology of Pain and thermal sensationsPhysiology of Pain and thermal sensations
Physiology of Pain and thermal sensations
MedicoseAcademics
 
Ad

MongoDB.pdf54teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeer

  • 1. MEET MONGODB MongoDB is a document-oriented database. It is a NoSQL database, meaning it does not use a traditional relational database structure. MongoDB is schema-less, meaning that you do not need to define the structure of your data in advance. MongoDB is highly scalable and can be used to store large amounts of data.
  • 2. MEET MONGODB MongoDB can manage Structured data Semi structured data Unstructured data NoSQL Databases No table No row No complex join
  • 3. MEET MONGODB Advantages Schema less single object No complex joins Deep query-ability Tuning Ease of scale-out Uses internal memory for storing Where to Use MongoDB Big Data Content Management and Delivery Mobile and Social Infrastructure User Data Management Data Hub
  • 5. EMBEDDED DATA MODEL In this model, you can have (embed) all the related data in a single document it is also known as de-normalized data model.
  • 6. NORMALIZED DATA MODEL In this model, you can refer the sub documents in the original document.
  • 8. SAMPLE DOCUMENT _id is a 12 bytes hexadecimal number First 4 bytes = current timestamp Next 3 bytes = machine id Next 2 bytes = process id Last 3 bytes = incremental VALUE
  • 9. MONGODB ATLAS MongoDB Atlas is a cloud-based database service That makes it easy to deploy, manage, and scale MongoDB databases Atlas is a fully managed service, so you don't need to worry about the underlying infrastructure Atlas is available on a variety of cloud providers, including AWS, Azure, and Google Cloud Platform
  • 10. Download & Install MongoDB Community Server Download & Install MongoDB Compass Connect Compass With Server INSTALL MONGODB ENVIRONMENT
  • 13. LOOK INSIDE MongoDB VS Code Extension
  • 15. DATABASE RELATED METHODS db.help() Common db objects. Displays method descriptions db.hostInfo() Returns a document record containing information about the operating system MongoDB is running on. db.getName() Returns the name of the current database. db.getMongo() Returns the name of the current database. db.currentOp() Reports the current in-progress operations.
  • 16. DATABASE RELATED METHODS db.dropDatabase() Removes the current database. db.getCollectionInfos() Returns collection information for all collections in the current database. db.getCollectionNames() Lists all collections in the current database. db.getLastError() Checks and returns the status of the last operation db.getLastErrorObj() Returns the status document for the last operation.
  • 17. DATABASE RELATED METHODS db.isMaster() Returns a document object containing a status report for the replica set. db.getReplicationInfo() Returns statistics for a replica set. db.listCommands() Displays a list of common database commands. db.logout() Terminates an authenticated session. db.printCollectionStats() Display statistics for each collection.
  • 18. DATABASE RELATED METHODS db.serverBuildInfo() Returns a mongod documentation record containing the compile parameters for the instance. db.serverStatus() Returns a document that provides an overview of the state of the database process. db.shutdownServer() Cleanly and safely stops the current mongod or mongos process. db.stats() Returns a document record containing a report on the current database state. db.version() Returns the version number of the mongod instance:
  • 19. DATABASE RELATED METHODS db.createCollection('demo') Returns a mongod documentation record containing the compile parameters for the instance. db.CollectionName.drop() It completely removes a collection from the database and does not leave any indexes associated with the dropped collections
  • 20. INSERT QUERY The insertOne() method allows you to insert a single document into a collection.
  • 21. INSERT QUERY The insertMany() allows you to insert multiple documents into a collection.
  • 22. FIND QUERY The findOne() returns a single document from a collection that satisfies the specified condition. The find() method finds the documents that satisfy a specified condition and returns a cursor to the matching documents
  • 23. PROJECTION In MongoDB, projection means selecting only the necessary data rather than selecting whole of the data of a document.
  • 24. COMPARISON QUERY OPERATOR $eq: Equal To Operator $lt: Less Than Operator $lte: Less Than or Equal To Operator $gt: Greater Than Operator $gte: Greater Than or Equal To Operator $ne: Not Equal To Operator $in: In Operator $nin: Not In Operator
  • 25. LOGICAL QUERY OPERATOR $and: Logical AND Opeartor $or: Logical OR Operator $not: Logical NOT operation $nor: Logical NOR operation
  • 26. ELEMENT QUERY OPERATOR $exists: Matches documents that have the specified field. $type: Selects documents if a field is of the specified type.
  • 28. EVALUATION QUERY OPERATOR $expr Allows use of aggregation expressions within the query language. $jsonSchema Validate documents against the given JSON Schema. $mod Performs a modulo operation on the value of a field and selects documents with a specified result. $regex Selects documents where values match a specified regular expression. $text Performs text search. $where Matches documents that satisfy a JavaScript expression.
  • 31. SORT LIMIT DISTINCT & ROW COUNT
  • 33. UPDATE ONE & MANY
  • 36. UPSERT Upsert is a combination of update and insert. Upsert performs two functions: Update data if there is a matching document. Insert a new document in case there is no document matches the query criteria.
  • 37. MEET AGGREGATION Allow you to process multiple documents and return the results. To perform aggregation operations, use aggregation pipelines. An aggregation pipeline contains one or more stages that process the input documents.
  • 38. SELECT , ROW COUNT IN AGGREGATION
  • 39. SORT LIMIT IN AGGREGATION
  • 40. SELECT FIRST 3 & LAST 3 AGGREGATION
  • 41. CAMPARISON OPERATOR AGGREGATION $eq: Equal To Operator $lt: Less Than Operator $lte: Less Than or Equal To Operator $gt: Greater Than Operator $gte: Greater Than or Equal To Operator $ne: Not Equal To Operator $in: In Operator $nin: Not In Operator
  • 42. LOGICAL OPERATOR AGGREGATION $and: Logical AND Opeartor $or: Logical OR Operator $not: Logical NOT operation $nor: Logical NOR operation
  • 43. ELEMENT QUERY OPERATORS AGGREGATION $exists: Matches documents that have the specified field. $type: Selects documents if a field is of the specified type.
  • 44. ELEMENT QUERY OPERATORS AGGREGATION