SlideShare una empresa de Scribd logo
1 de 25
MongoDB
MongoDB is a document-oriented database, not a relational one.
A document-oriented database replaces the concept of a “row” with a more flexible
model, the “document.”
MongoDB is intended to be a general-purpose database so aside from creating, reading,
updating, and deleting data
Indexing
Aggregation
Special collection types
MongoDB is made up of databases which contain collections. A collection is made up of
documents.
Each document is made up of fields. Collections can be indexed, which improves lookup and
sorting performance.
Finally, when we get data from MongoDB we do so through a cursor whose actual execution is
delayed until necessary.
In JavaScript, for example, documents are represented as objects:
{
"greeting“ : "Hello, world!“
}
This simple document contains a single key, "greeting“ , with a value of "Hello,
world!“ . Most documents will be more complex than this simple one and often will
contain multiple key/value pairs:
{ "greeting“ :"Hello, world!","foo":3 }
The keys in a document are strings. Any UTF-8 character is allowed in a key, with a few
notable exceptions:
Keys must not contain the character 0 (the null character). This character is used
to signify the end of a key
The . and $ characters have some special properties and should be used only in certain
circumstances, as described in later chapters. In general, they should be considered reserved,
and drivers will complain if they are used inappropriately.
MongoDB is type-sensitive and case-sensitive
Collections:
A collection is a group of documents.
Dynamic Schemas:
Collections have dynamic schemas . This means that the documents within a single col‐
lection can have any number of different “shapes.”
{"greeting“ : "Hello, world!"}
{ "foo":5}
Naming:
A collection is identified by its name. Collection names can be any UTF-8 string, with
a few restrictions:
The empty string ("") is not a valid collection name
Collection names may not contain the character 0 (the null character) because this delineates
the end of a collection name.
Getting and Starting MongoDB
MongoDB is almost always run as a network server that clients can connect to and
perform operations on
$ mongod
mongod --help
for help and startup options.
When run with no arguments, mongod will use the default data directory, /data/db/
(or datadb on the current volume on Windows).
If the data directory does not already exist or is not writable, the server will fail to start. It is
important to create the data directory (e.g., mkdir -p /data/db/ ) and to make sure your user
has permission to write to the directory before starting MongoDB
Running the Shell
To start the shell, run the mongo executable:
$Mongo
MongoDB shell
version : 2.4 . 0
connecting to : test >
The shell is a full-featured JavaScript interpreter, capable of running arbitrary JavaScript
programs. To illustrate this, let’s perform some basic math:
>x
=200
200
>x/5;
40
A MongoDB Client
To see the database db is currently assigned to, type in db and hit Enter:
>db
Test
Basic Operations with the Shel
CRUD:
create, read, update, and delete to manipulate and view data in the shell.
Data Types
Basic Data Types
Documents in MongoDB can be thought of as “JSON-like” in that they are conceptually
similar to objects in JavaScript.
JSON is a simple representation of data: the specification can be described in about one
paragraph (their website proves it) and lists only six data types.
The most common types are
Null
Dates
Arrays
Embedded documents
Running Scripts with the Shel
Creating, Updating, and
Deleting Documents
Adding new documents to a collection
• Removing documents from a collection
• Updating existing documents
• Choosing the correct level of safety versus speed for all of these operations
Inserting and Saving Documents
Inserts are the basic method for adding data to MongoDB.
Batch Insert
Batch inserts allow you to pass an array of documents to the database.
Insert Validation
MongoDB does minimal checks on data being inserted:
Removing Documents
Now that there’s data in our database, let’s delete it:
Remove Speed
Removing documents is usually a fairly quick operation.
Updating Documents
Setting a Write Concern
Querying
Find method is used to perform queries in MongoDB.
Specifying Which Keys to Return
Sometimes you do not need all of the key/value pairs in a document returned.
Cursors
The database returns results from find using a cursor.

Más contenido relacionado

La actualidad más candente

Get expertise with mongo db
Get expertise with mongo dbGet expertise with mongo db
Get expertise with mongo dbAmit Thakkar
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB Habilelabs
 
Top 10 frameworks of node js
Top 10 frameworks of node jsTop 10 frameworks of node js
Top 10 frameworks of node jsHabilelabs
 
Connecting NodeJS & MongoDB
Connecting NodeJS & MongoDBConnecting NodeJS & MongoDB
Connecting NodeJS & MongoDBEnoch Joshua
 
MongoDB presentation
MongoDB presentationMongoDB presentation
MongoDB presentationHyphen Call
 
Mongodb intro
Mongodb introMongodb intro
Mongodb introchristkv
 
MongoDB: An Introduction - june-2011
MongoDB:  An Introduction - june-2011MongoDB:  An Introduction - june-2011
MongoDB: An Introduction - june-2011Chris Westin
 
The Basics of MongoDB
The Basics of MongoDBThe Basics of MongoDB
The Basics of MongoDBvaluebound
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBMike Dirolf
 
An introduction to MongoDB
An introduction to MongoDBAn introduction to MongoDB
An introduction to MongoDBCésar Trigo
 
Introduction to mongo db
Introduction to mongo dbIntroduction to mongo db
Introduction to mongo dbRohit Bishnoi
 

La actualidad más candente (20)

Mongo DB 102
Mongo DB 102Mongo DB 102
Mongo DB 102
 
Get expertise with mongo db
Get expertise with mongo dbGet expertise with mongo db
Get expertise with mongo db
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB
 
Top 10 frameworks of node js
Top 10 frameworks of node jsTop 10 frameworks of node js
Top 10 frameworks of node js
 
Connecting NodeJS & MongoDB
Connecting NodeJS & MongoDBConnecting NodeJS & MongoDB
Connecting NodeJS & MongoDB
 
MongoDB 101
MongoDB 101MongoDB 101
MongoDB 101
 
Mongo db
Mongo dbMongo db
Mongo db
 
Mongo DB Presentation
Mongo DB PresentationMongo DB Presentation
Mongo DB Presentation
 
MongoDB presentation
MongoDB presentationMongoDB presentation
MongoDB presentation
 
MongoDB
MongoDBMongoDB
MongoDB
 
Mongo db workshop # 01
Mongo db workshop # 01Mongo db workshop # 01
Mongo db workshop # 01
 
Mongodb intro
Mongodb introMongodb intro
Mongodb intro
 
MongoDB: An Introduction - june-2011
MongoDB:  An Introduction - june-2011MongoDB:  An Introduction - june-2011
MongoDB: An Introduction - june-2011
 
The Basics of MongoDB
The Basics of MongoDBThe Basics of MongoDB
The Basics of MongoDB
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Introduction to mongodb
Introduction to mongodbIntroduction to mongodb
Introduction to mongodb
 
An introduction to MongoDB
An introduction to MongoDBAn introduction to MongoDB
An introduction to MongoDB
 
Mongo db
Mongo dbMongo db
Mongo db
 
Mongo db dhruba
Mongo db dhrubaMongo db dhruba
Mongo db dhruba
 
Introduction to mongo db
Introduction to mongo dbIntroduction to mongo db
Introduction to mongo db
 

Destacado

Steve Carpenter Art | Four Seasons Mural | Press Release 2014
Steve Carpenter Art | Four Seasons Mural | Press Release 2014Steve Carpenter Art | Four Seasons Mural | Press Release 2014
Steve Carpenter Art | Four Seasons Mural | Press Release 2014Debra VanWert
 
Open educational resources - Pros and Cons
Open educational resources - Pros and ConsOpen educational resources - Pros and Cons
Open educational resources - Pros and ConsMediaLib
 
Rehabilitacion Psicosicial Jornada cd lleida 2011
Rehabilitacion Psicosicial Jornada cd lleida 2011Rehabilitacion Psicosicial Jornada cd lleida 2011
Rehabilitacion Psicosicial Jornada cd lleida 2011jrbellidomainar
 
דוקטור מוטי משיח על התמכרות לאלכוהול
דוקטור מוטי משיח על התמכרות לאלכוהולדוקטור מוטי משיח על התמכרות לאלכוהול
דוקטור מוטי משיח על התמכרות לאלכוהולמוטי משיח
 
CURRICULUM VITAE GR
CURRICULUM VITAE GRCURRICULUM VITAE GR
CURRICULUM VITAE GRGirdhari Ram
 
Appreciating differences certificate
Appreciating differences certificateAppreciating differences certificate
Appreciating differences certificateRehan Mohamed
 
Alejandro Exarcheas-Ibarra's Personal Persona Project
Alejandro Exarcheas-Ibarra's Personal Persona ProjectAlejandro Exarcheas-Ibarra's Personal Persona Project
Alejandro Exarcheas-Ibarra's Personal Persona ProjectAlejandro Ibarra
 
на барикадах кенгіра
на барикадах кенгірана барикадах кенгіра
на барикадах кенгіраkayasavchuk
 
AFNetworking
AFNetworking AFNetworking
AFNetworking joaopmaia
 
J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Touroscon2007
 
Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorialprathap kumar
 

Destacado (20)

Innovative
InnovativeInnovative
Innovative
 
Steve Carpenter Art | Four Seasons Mural | Press Release 2014
Steve Carpenter Art | Four Seasons Mural | Press Release 2014Steve Carpenter Art | Four Seasons Mural | Press Release 2014
Steve Carpenter Art | Four Seasons Mural | Press Release 2014
 
Open educational resources - Pros and Cons
Open educational resources - Pros and ConsOpen educational resources - Pros and Cons
Open educational resources - Pros and Cons
 
How to leave smoking
How to leave smokingHow to leave smoking
How to leave smoking
 
Siddhant Resume 1
Siddhant Resume 1Siddhant Resume 1
Siddhant Resume 1
 
Rehabilitacion Psicosicial Jornada cd lleida 2011
Rehabilitacion Psicosicial Jornada cd lleida 2011Rehabilitacion Psicosicial Jornada cd lleida 2011
Rehabilitacion Psicosicial Jornada cd lleida 2011
 
דוקטור מוטי משיח על התמכרות לאלכוהול
דוקטור מוטי משיח על התמכרות לאלכוהולדוקטור מוטי משיח על התמכרות לאלכוהול
דוקטור מוטי משיח על התמכרות לאלכוהול
 
M F -CV 2015
M F -CV 2015M F -CV 2015
M F -CV 2015
 
ASU Degree
ASU DegreeASU Degree
ASU Degree
 
CURRICULUM VITAE GR
CURRICULUM VITAE GRCURRICULUM VITAE GR
CURRICULUM VITAE GR
 
Fragkopoulou_Katerina_Master thesis
Fragkopoulou_Katerina_Master thesisFragkopoulou_Katerina_Master thesis
Fragkopoulou_Katerina_Master thesis
 
Appreciating differences certificate
Appreciating differences certificateAppreciating differences certificate
Appreciating differences certificate
 
Alejandro Exarcheas-Ibarra's Personal Persona Project
Alejandro Exarcheas-Ibarra's Personal Persona ProjectAlejandro Exarcheas-Ibarra's Personal Persona Project
Alejandro Exarcheas-Ibarra's Personal Persona Project
 
на барикадах кенгіра
на барикадах кенгірана барикадах кенгіра
на барикадах кенгіра
 
Oracle sql material
Oracle sql materialOracle sql material
Oracle sql material
 
AFNetworking
AFNetworking AFNetworking
AFNetworking
 
E
EE
E
 
27 fcs157al3
27 fcs157al327 fcs157al3
27 fcs157al3
 
J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Tour
 
Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorial
 

Similar a Mongo db

Similar a Mongo db (20)

MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introduction
 
Mongo db
Mongo dbMongo db
Mongo db
 
Mongo DB
Mongo DBMongo DB
Mongo DB
 
lecture_34e.pptx
lecture_34e.pptxlecture_34e.pptx
lecture_34e.pptx
 
3-Mongodb and Mapreduce Programming.pdf
3-Mongodb and Mapreduce Programming.pdf3-Mongodb and Mapreduce Programming.pdf
3-Mongodb and Mapreduce Programming.pdf
 
Top MongoDB interview Questions and Answers
Top MongoDB interview Questions and AnswersTop MongoDB interview Questions and Answers
Top MongoDB interview Questions and Answers
 
Kalp Corporate MongoDB Tutorials
Kalp Corporate MongoDB TutorialsKalp Corporate MongoDB Tutorials
Kalp Corporate MongoDB Tutorials
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Mongodb By Vipin
Mongodb By VipinMongodb By Vipin
Mongodb By Vipin
 
Mongodb Introduction
Mongodb IntroductionMongodb Introduction
Mongodb Introduction
 
Mondodb
MondodbMondodb
Mondodb
 
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introduction
 
Mongo learning series
Mongo learning series Mongo learning series
Mongo learning series
 
MongoDB
MongoDBMongoDB
MongoDB
 
Building your first app with MongoDB
Building your first app with MongoDBBuilding your first app with MongoDB
Building your first app with MongoDB
 
Mongodb - NoSql Database
Mongodb - NoSql DatabaseMongodb - NoSql Database
Mongodb - NoSql Database
 
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
 
Introduction to mongo db
Introduction to mongo dbIntroduction to mongo db
Introduction to mongo db
 
The emerging world of mongo db csp
The emerging world of mongo db   cspThe emerging world of mongo db   csp
The emerging world of mongo db csp
 
Introduction to MongoDB.pptx
Introduction to MongoDB.pptxIntroduction to MongoDB.pptx
Introduction to MongoDB.pptx
 

Más de Raghu nath

Ftp (file transfer protocol)
Ftp (file transfer protocol)Ftp (file transfer protocol)
Ftp (file transfer protocol)Raghu nath
 
Javascript part1
Javascript part1Javascript part1
Javascript part1Raghu nath
 
Regular expressions
Regular expressionsRegular expressions
Regular expressionsRaghu nath
 
Selection sort
Selection sortSelection sort
Selection sortRaghu nath
 
Binary search
Binary search Binary search
Binary search Raghu nath
 
JSON(JavaScript Object Notation)
JSON(JavaScript Object Notation)JSON(JavaScript Object Notation)
JSON(JavaScript Object Notation)Raghu nath
 
Stemming algorithms
Stemming algorithmsStemming algorithms
Stemming algorithmsRaghu nath
 
Step by step guide to install dhcp role
Step by step guide to install dhcp roleStep by step guide to install dhcp role
Step by step guide to install dhcp roleRaghu nath
 
Network essentials chapter 4
Network essentials  chapter 4Network essentials  chapter 4
Network essentials chapter 4Raghu nath
 
Network essentials chapter 3
Network essentials  chapter 3Network essentials  chapter 3
Network essentials chapter 3Raghu nath
 
Network essentials chapter 2
Network essentials  chapter 2Network essentials  chapter 2
Network essentials chapter 2Raghu nath
 
Network essentials - chapter 1
Network essentials - chapter 1Network essentials - chapter 1
Network essentials - chapter 1Raghu nath
 
Python chapter 2
Python chapter 2Python chapter 2
Python chapter 2Raghu nath
 
python chapter 1
python chapter 1python chapter 1
python chapter 1Raghu nath
 
Linux Shell Scripting
Linux Shell ScriptingLinux Shell Scripting
Linux Shell ScriptingRaghu nath
 
Adv excel® 2013
Adv excel® 2013Adv excel® 2013
Adv excel® 2013Raghu nath
 

Más de Raghu nath (20)

Ftp (file transfer protocol)
Ftp (file transfer protocol)Ftp (file transfer protocol)
Ftp (file transfer protocol)
 
MS WORD 2013
MS WORD 2013MS WORD 2013
MS WORD 2013
 
Msword
MswordMsword
Msword
 
Ms word
Ms wordMs word
Ms word
 
Javascript part1
Javascript part1Javascript part1
Javascript part1
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Selection sort
Selection sortSelection sort
Selection sort
 
Binary search
Binary search Binary search
Binary search
 
JSON(JavaScript Object Notation)
JSON(JavaScript Object Notation)JSON(JavaScript Object Notation)
JSON(JavaScript Object Notation)
 
Stemming algorithms
Stemming algorithmsStemming algorithms
Stemming algorithms
 
Step by step guide to install dhcp role
Step by step guide to install dhcp roleStep by step guide to install dhcp role
Step by step guide to install dhcp role
 
Network essentials chapter 4
Network essentials  chapter 4Network essentials  chapter 4
Network essentials chapter 4
 
Network essentials chapter 3
Network essentials  chapter 3Network essentials  chapter 3
Network essentials chapter 3
 
Network essentials chapter 2
Network essentials  chapter 2Network essentials  chapter 2
Network essentials chapter 2
 
Network essentials - chapter 1
Network essentials - chapter 1Network essentials - chapter 1
Network essentials - chapter 1
 
Python chapter 2
Python chapter 2Python chapter 2
Python chapter 2
 
python chapter 1
python chapter 1python chapter 1
python chapter 1
 
Linux Shell Scripting
Linux Shell ScriptingLinux Shell Scripting
Linux Shell Scripting
 
Perl
PerlPerl
Perl
 
Adv excel® 2013
Adv excel® 2013Adv excel® 2013
Adv excel® 2013
 

Último

ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
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-701bronxfugly43
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 

Último (20)

ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
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
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 

Mongo db

  • 2. MongoDB is a document-oriented database, not a relational one. A document-oriented database replaces the concept of a “row” with a more flexible model, the “document.”
  • 3. MongoDB is intended to be a general-purpose database so aside from creating, reading, updating, and deleting data Indexing Aggregation Special collection types
  • 4. MongoDB is made up of databases which contain collections. A collection is made up of documents. Each document is made up of fields. Collections can be indexed, which improves lookup and sorting performance. Finally, when we get data from MongoDB we do so through a cursor whose actual execution is delayed until necessary.
  • 5. In JavaScript, for example, documents are represented as objects: { "greeting“ : "Hello, world!“ }
  • 6. This simple document contains a single key, "greeting“ , with a value of "Hello, world!“ . Most documents will be more complex than this simple one and often will contain multiple key/value pairs: { "greeting“ :"Hello, world!","foo":3 }
  • 7. The keys in a document are strings. Any UTF-8 character is allowed in a key, with a few notable exceptions: Keys must not contain the character 0 (the null character). This character is used to signify the end of a key
  • 8. The . and $ characters have some special properties and should be used only in certain circumstances, as described in later chapters. In general, they should be considered reserved, and drivers will complain if they are used inappropriately.
  • 9. MongoDB is type-sensitive and case-sensitive Collections: A collection is a group of documents. Dynamic Schemas: Collections have dynamic schemas . This means that the documents within a single col‐ lection can have any number of different “shapes.”
  • 10. {"greeting“ : "Hello, world!"} { "foo":5} Naming: A collection is identified by its name. Collection names can be any UTF-8 string, with a few restrictions: The empty string ("") is not a valid collection name
  • 11. Collection names may not contain the character 0 (the null character) because this delineates the end of a collection name.
  • 12. Getting and Starting MongoDB MongoDB is almost always run as a network server that clients can connect to and perform operations on $ mongod mongod --help for help and startup options.
  • 13. When run with no arguments, mongod will use the default data directory, /data/db/ (or datadb on the current volume on Windows). If the data directory does not already exist or is not writable, the server will fail to start. It is important to create the data directory (e.g., mkdir -p /data/db/ ) and to make sure your user has permission to write to the directory before starting MongoDB
  • 14. Running the Shell To start the shell, run the mongo executable: $Mongo MongoDB shell version : 2.4 . 0 connecting to : test >
  • 15. The shell is a full-featured JavaScript interpreter, capable of running arbitrary JavaScript programs. To illustrate this, let’s perform some basic math: >x =200 200 >x/5; 40
  • 16. A MongoDB Client To see the database db is currently assigned to, type in db and hit Enter: >db Test
  • 17. Basic Operations with the Shel CRUD: create, read, update, and delete to manipulate and view data in the shell.
  • 18. Data Types Basic Data Types Documents in MongoDB can be thought of as “JSON-like” in that they are conceptually similar to objects in JavaScript. JSON is a simple representation of data: the specification can be described in about one paragraph (their website proves it) and lists only six data types.
  • 19. The most common types are Null Dates Arrays Embedded documents
  • 21. Creating, Updating, and Deleting Documents Adding new documents to a collection • Removing documents from a collection • Updating existing documents • Choosing the correct level of safety versus speed for all of these operations
  • 22. Inserting and Saving Documents Inserts are the basic method for adding data to MongoDB. Batch Insert Batch inserts allow you to pass an array of documents to the database. Insert Validation MongoDB does minimal checks on data being inserted:
  • 23. Removing Documents Now that there’s data in our database, let’s delete it: Remove Speed Removing documents is usually a fairly quick operation. Updating Documents Setting a Write Concern
  • 24. Querying Find method is used to perform queries in MongoDB. Specifying Which Keys to Return Sometimes you do not need all of the key/value pairs in a document returned.
  • 25. Cursors The database returns results from find using a cursor.