SlideShare ist ein Scribd-Unternehmen logo
1 von 18
MongoDB
OPEN-SOURCE DOCUMENT DATABASE – AN INTRODUCTION
DINKAR THAKUR
dinkar@wiziq.com
DINKAR THAKUR 1
Why NoSQL
NoSQL databases are more scalable and provide superior performance, and
addresses several issues that the relational model is not designed to address:
 Large volumes of structured, semi-structured, and unstructured data.
 Agile sprints, quick iteration, and frequent code pushes.
 Efficient, scale-out architecture instead of expensive, monolithic architecture.
 Dynamic Schemas.
 Sharding.
 Integrated Caching.
DINKAR THAKUR 2
Document Database
 Each record and is associated data is thought of as a “document”.
 Every thing related to a database object is encapsulated together.
 MongoDB has flexible schema, Unlike the SQL Databases, where you must
determine and declare a table’s schema before inserting data.
DINKAR THAKUR 3
SQL TERM MONGODB TERM
database database
table collection
index index
row document
column field
joining embedding & linking
MongoDB’s collections do not
enforce document structure.
This means every row can
have it’s own structure.
Document Structure
 MongoDB stores data in the form of documents, which are JSON-like
objects and value pairs.
 Documents are analogous to structures in programming languages that
associate keys with values.
 Formally, MongoDB documents are BSON (Binary representation of JSON)
documents.
DINKAR THAKUR 4
The field name _id is reserved for use as a
primary key. Its value must be unique in the
collection, is immutable, and may be of any type
other than an array.
The field names cannot start with the dollar sign
($) character.
The field names cannot contain the dot (.)
character.
The field names cannot contain the null character
Collections
 MongoDB stores all documents in collections.
 A collection is a group of related documents that have a set of shared
common indexes.
 Collections are analogous to a table in relational databases.
DINKAR THAKUR 5
Now we Know the basic of MongoDB.
Let’s start with it.
You can follow installation instruction
from
http://docs.mongodb.org/manual/tutori
al/install-mongodb-on-windows/
Components :- mongod
 mongod is the primary daemon process for the MongoDB system.
 It handles data requests, manages data format, and performs background
management operations.
--help, -h
Returns information on the options and use of mongod.
--version
Returns the mongod release number.
--config <filename>, -f
Specifies a configuration file for runtime configuration options. The
configuration file is the preferred method for runtime configuration of mongod.
The options are equivalent to the command-line configuration options.
DINKAR THAKUR 6
Components :- mongo and
mongos
 The mongo shell is an interactive JavaScript shell for MongoDB, and is part of
all MongoDB distributions.
 To display the database you are using, type db
The command should return test, which is the default database. To switch
databases, issue the
use <db> command, like “use logdatabase”
 To list the available databases, use the command show dbs.
To access a different database from the current database without switching
your current database context. Like “db.getSiblingDB('sampleDB').getCollectionNames()”
DINKAR THAKUR 7
mongos for “MongoDB Shard,” is a routing service for MongoDB shard configurations that processes
queries from the application layer, and determines the location of this data in the sharded cluster, in
order to complete these operations. From the perspective of the application, a mongos instance
behaves identically to any other MongoDB instance.
MongoDB CRUD Introduction(Query)
 In MongoDB a query targets a specific collection of documents.
 Queries specify criteria, or conditions, that identify the documents that
MongoDB returns to the clients.
 A query may include a projection that specifies the fields from the matching
documents to return.
 You can optionally modify queries to impose limits, skips, and sort orders.
 No Joins.
DINKAR THAKUR 8
Data Modification – Insert
 Data modification refers to operations that create, update, or delete data.
 In MongoDB, these operations modify the data of a single collection.
 For the update and delete operations, you can specify the criteria to select
the documents to update or remove.
DINKAR THAKUR 9
Update
 Update operations modify existing documents in a collection.
 In MongoDB, db.collection.update() and the db.collection.save() methods perform
update operations.
 The db.collection.update() method can accept query criteria to determine which
documents to update as well as an option to update multiple rows.
The following example finds all documents with type equal to "book" and modifies their qty field by -1.
db.inventory.update({ type : "book" }, { $inc : { qty : -1 } }, { multi: true
})
 The save() method can replace an existing document. To replace a document with the
save() method, pass the method a document with an _id field that matches an existing
document.
The following example completely replaces the document with the _id equal to 10 in the inventory collection
db.inventory.save({ _id: 10, type: "misc", item: "placard" })
DINKAR THAKUR 10
Read
Read operations, or queries, retrieve data stored in the database. In
MongoDB, queries select documents from a single collection.
 For query operations, MongoDB provide a db.collection.find() method.
 The method accepts both the query criteria and projections and returns a cursor to
the matching documents.
DINKAR THAKUR 11
Delete
The db.collection.remove() method removes documents from a
collection.
 You can remove all documents from a collection.
db.inventory.remove({})
 Remove all documents that match a condition.
db.inventory.remove( { type : "food" } )
 Limit the operation to remove just a single document.
db.inventory.remove( { type : "food" }, 1 )
DINKAR THAKUR 12
Continued…(Related Features)
 Indexes :-
MongoDB has full support for secondary indexes.
These indexes allow applications to store a view of a portion of the collection in an efficient
data structure.
Most indexes store an ordered representation of all values of a field or a group of fields.
Indexes may also enforce uniqueness, store objects in a geospatial representation, and
facilitate text search.
 Read Preference :-
By default, an application directs its read operations to the primary member in a replica set.
Reading from the primary guarantees that read operations reflect the latest version of a
document.
By distributing some or all reads to secondary members of the replica set, you can improve
read throughput or reduce latency for an application that does not require fully up-to-date data.
DINKAR THAKUR 13
Read Preference Mode Description
primary Default mode. All operations read from the current replica set primary.
primaryPreferred In most situations, operations read from the primary but if it is unavailable, operations read from secondary members.
secondary All operations read from the secondary members of the replica set.
secondaryPreferred
In most situations, operations read from secondary members but if no secondary members are available, operations read
from the primary.
nearest Operations read from member of the replica set with the least network latency, irrespective of the member’s type.
Continued…
 Write Concern :-
A write operation is any operation that creates or modifies data in the MongoDB instance.
In MongoDB, write operations target a single collection.
All write operations in MongoDB are atomic on the level of a single document.
There are three classes of write operations in MongoDB: insert, update, and remove.
Insert operations add new data to a collection.
Update operations modify existing data, and remove operations delete data from a
collection.
No insert, update, or remove can affect more than one document atomically.
DINKAR THAKUR 14
Mongo Comparison
DINKAR THAKUR 15
Advanced Features
 Indexing.
 Writes and Reads using memory only and data persistence.
 Write and Read Operations in a clustered environment.
 Sharding (automatic and manual) and Reading.
 Replication.
 GridFS.
DINKAR THAKUR 16
Uses of MongoDB
 MongoDB has a general-purpose design, making it appropriate for a large
number of use cases.
 Examples include content management systems, mobile applications,
gaming, e-commerce, analytics, archiving, and logging.
 Easy integration with C,C++, Java, GO, Node.js, Perl, PHP, Python, Ruby, Scala
and C#
We can even use LINQ and lambda syntax on the MongoDB
result set. That’s a big advantage over other when .net is used.
DINKAR THAKUR 17
Thank you
DINKAR THAKUR 18

Weitere ähnliche Inhalte

Was ist angesagt?

MongoDB presentation
MongoDB presentationMongoDB presentation
MongoDB presentationHyphen Call
 
MongoDB: An Introduction - june-2011
MongoDB:  An Introduction - june-2011MongoDB:  An Introduction - june-2011
MongoDB: An Introduction - june-2011Chris Westin
 
Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)Kai Zhao
 
Analysis on NoSQL: MongoDB Tool
Analysis on NoSQL: MongoDB ToolAnalysis on NoSQL: MongoDB Tool
Analysis on NoSQL: MongoDB Toolijtsrd
 
PostgreSQL - Object Relational Database
PostgreSQL - Object Relational DatabasePostgreSQL - Object Relational Database
PostgreSQL - Object Relational DatabaseMubashar Iqbal
 
Automated Slow Query Analysis: Dex the Index Robot
Automated Slow Query Analysis: Dex the Index RobotAutomated Slow Query Analysis: Dex the Index Robot
Automated Slow Query Analysis: Dex the Index RobotMongoDB
 
15. session 15 data binding
15. session 15   data binding15. session 15   data binding
15. session 15 data bindingPhúc Đỗ
 
Chapter 5 design of keyvalue databses from nosql for mere mortals
Chapter 5 design of keyvalue databses from nosql for mere mortalsChapter 5 design of keyvalue databses from nosql for mere mortals
Chapter 5 design of keyvalue databses from nosql for mere mortalsnehabsairam
 
Ado.Net Architecture
Ado.Net ArchitectureAdo.Net Architecture
Ado.Net ArchitectureUmar Farooq
 
Small Overview of Skype Database Tools
Small Overview of Skype Database ToolsSmall Overview of Skype Database Tools
Small Overview of Skype Database Toolselliando dias
 
performance analysis between sql ans nosql
performance analysis between sql ans nosqlperformance analysis between sql ans nosql
performance analysis between sql ans nosqlRUFAI YUSUF
 
Mongodb basics and architecture
Mongodb basics and architectureMongodb basics and architecture
Mongodb basics and architectureBishal Khanal
 
Ado.net &amp; data persistence frameworks
Ado.net &amp; data persistence frameworksAdo.net &amp; data persistence frameworks
Ado.net &amp; data persistence frameworksLuis Goldster
 
MongoDB NoSQL - Developer Guide
MongoDB NoSQL - Developer GuideMongoDB NoSQL - Developer Guide
MongoDB NoSQL - Developer GuideShiv K Sah
 

Was ist angesagt? (20)

Mongodb Introduction
Mongodb IntroductionMongodb Introduction
Mongodb Introduction
 
MongoDB presentation
MongoDB presentationMongoDB presentation
MongoDB presentation
 
MongoDB: An Introduction - june-2011
MongoDB:  An Introduction - june-2011MongoDB:  An Introduction - june-2011
MongoDB: An Introduction - june-2011
 
Mongo db report
Mongo db reportMongo db report
Mongo db report
 
Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)Mongodb introduction and_internal(simple)
Mongodb introduction and_internal(simple)
 
Analysis on NoSQL: MongoDB Tool
Analysis on NoSQL: MongoDB ToolAnalysis on NoSQL: MongoDB Tool
Analysis on NoSQL: MongoDB Tool
 
PostgreSQL - Object Relational Database
PostgreSQL - Object Relational DatabasePostgreSQL - Object Relational Database
PostgreSQL - Object Relational Database
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Automated Slow Query Analysis: Dex the Index Robot
Automated Slow Query Analysis: Dex the Index RobotAutomated Slow Query Analysis: Dex the Index Robot
Automated Slow Query Analysis: Dex the Index Robot
 
15. session 15 data binding
15. session 15   data binding15. session 15   data binding
15. session 15 data binding
 
Chapter 5 design of keyvalue databses from nosql for mere mortals
Chapter 5 design of keyvalue databses from nosql for mere mortalsChapter 5 design of keyvalue databses from nosql for mere mortals
Chapter 5 design of keyvalue databses from nosql for mere mortals
 
Ado.Net Architecture
Ado.Net ArchitectureAdo.Net Architecture
Ado.Net Architecture
 
Small Overview of Skype Database Tools
Small Overview of Skype Database ToolsSmall Overview of Skype Database Tools
Small Overview of Skype Database Tools
 
Mdb dn 2016_06_query_primer
Mdb dn 2016_06_query_primerMdb dn 2016_06_query_primer
Mdb dn 2016_06_query_primer
 
performance analysis between sql ans nosql
performance analysis between sql ans nosqlperformance analysis between sql ans nosql
performance analysis between sql ans nosql
 
Mongodb basics and architecture
Mongodb basics and architectureMongodb basics and architecture
Mongodb basics and architecture
 
Key-Value NoSQL Database
Key-Value NoSQL DatabaseKey-Value NoSQL Database
Key-Value NoSQL Database
 
Ado.net &amp; data persistence frameworks
Ado.net &amp; data persistence frameworksAdo.net &amp; data persistence frameworks
Ado.net &amp; data persistence frameworks
 
Mongo DB
Mongo DBMongo DB
Mongo DB
 
MongoDB NoSQL - Developer Guide
MongoDB NoSQL - Developer GuideMongoDB NoSQL - Developer Guide
MongoDB NoSQL - Developer Guide
 

Ähnlich wie MongoDB - An Introduction

Introduction to MongoDB and its best practices
Introduction to MongoDB and its best practicesIntroduction to MongoDB and its best practices
Introduction to MongoDB and its best practicesAshishRathore72
 
Introduction to MongoDB.pptx
Introduction to MongoDB.pptxIntroduction to MongoDB.pptx
Introduction to MongoDB.pptxSurya937648
 
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introductionsethfloydjr
 
What are the major components of MongoDB and the major tools used in it.docx
What are the major components of MongoDB and the major tools used in it.docxWhat are the major components of MongoDB and the major tools used in it.docx
What are the major components of MongoDB and the major tools used in it.docxTechnogeeks
 
A Study on Mongodb Database.pdf
A Study on Mongodb Database.pdfA Study on Mongodb Database.pdf
A Study on Mongodb Database.pdfJessica Navarro
 
A Study on Mongodb Database
A Study on Mongodb DatabaseA Study on Mongodb Database
A Study on Mongodb DatabaseIJSRD
 
Introduction To MongoDB
Introduction To MongoDBIntroduction To MongoDB
Introduction To MongoDBElieHannouch
 
MongoDB installation,CRUD operation & JavaScript shell
MongoDB installation,CRUD operation & JavaScript shellMongoDB installation,CRUD operation & JavaScript shell
MongoDB installation,CRUD operation & JavaScript shellShahDhruv21
 
Top MongoDB interview Questions and Answers
Top MongoDB interview Questions and AnswersTop MongoDB interview Questions and Answers
Top MongoDB interview Questions and Answersjeetendra mandal
 
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 -MyWhitePaperRajesh Kumar
 
MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...
MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...
MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...ijcsity
 
MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...
MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...
MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...ijcsity
 
MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...
MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...
MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...ijcsity
 
Klevis Mino: MongoDB
Klevis Mino: MongoDBKlevis Mino: MongoDB
Klevis Mino: MongoDBCarlo Vaccari
 
Analytical data processing
Analytical data processingAnalytical data processing
Analytical data processingPolad Saruxanov
 

Ähnlich wie MongoDB - An Introduction (20)

Introduction to MongoDB and its best practices
Introduction to MongoDB and its best practicesIntroduction to MongoDB and its best practices
Introduction to MongoDB and its best practices
 
Mongo db
Mongo dbMongo db
Mongo db
 
Introduction to MongoDB.pptx
Introduction to MongoDB.pptxIntroduction to MongoDB.pptx
Introduction to MongoDB.pptx
 
Mongodb By Vipin
Mongodb By VipinMongodb By Vipin
Mongodb By Vipin
 
Mongo db dhruba
Mongo db dhrubaMongo db dhruba
Mongo db dhruba
 
MongoDB - An Introduction
MongoDB - An IntroductionMongoDB - An Introduction
MongoDB - An Introduction
 
What are the major components of MongoDB and the major tools used in it.docx
What are the major components of MongoDB and the major tools used in it.docxWhat are the major components of MongoDB and the major tools used in it.docx
What are the major components of MongoDB and the major tools used in it.docx
 
A Study on Mongodb Database.pdf
A Study on Mongodb Database.pdfA Study on Mongodb Database.pdf
A Study on Mongodb Database.pdf
 
A Study on Mongodb Database
A Study on Mongodb DatabaseA Study on Mongodb Database
A Study on Mongodb Database
 
Mongodb
MongodbMongodb
Mongodb
 
Introduction To MongoDB
Introduction To MongoDBIntroduction To MongoDB
Introduction To MongoDB
 
MongoDB installation,CRUD operation & JavaScript shell
MongoDB installation,CRUD operation & JavaScript shellMongoDB installation,CRUD operation & JavaScript shell
MongoDB installation,CRUD operation & JavaScript shell
 
Top MongoDB interview Questions and Answers
Top MongoDB interview Questions and AnswersTop MongoDB interview Questions and Answers
Top MongoDB interview Questions and Answers
 
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
 
MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...
MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...
MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...
 
MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...
MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...
MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...
 
MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...
MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...
MONGODB VS MYSQL: A COMPARATIVE STUDY OF PERFORMANCE IN SUPER MARKET MANAGEME...
 
MongoDB
MongoDBMongoDB
MongoDB
 
Klevis Mino: MongoDB
Klevis Mino: MongoDBKlevis Mino: MongoDB
Klevis Mino: MongoDB
 
Analytical data processing
Analytical data processingAnalytical data processing
Analytical data processing
 

Kürzlich hochgeladen

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 

Kürzlich hochgeladen (20)

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 

MongoDB - An Introduction

  • 1. MongoDB OPEN-SOURCE DOCUMENT DATABASE – AN INTRODUCTION DINKAR THAKUR dinkar@wiziq.com DINKAR THAKUR 1
  • 2. Why NoSQL NoSQL databases are more scalable and provide superior performance, and addresses several issues that the relational model is not designed to address:  Large volumes of structured, semi-structured, and unstructured data.  Agile sprints, quick iteration, and frequent code pushes.  Efficient, scale-out architecture instead of expensive, monolithic architecture.  Dynamic Schemas.  Sharding.  Integrated Caching. DINKAR THAKUR 2
  • 3. Document Database  Each record and is associated data is thought of as a “document”.  Every thing related to a database object is encapsulated together.  MongoDB has flexible schema, Unlike the SQL Databases, where you must determine and declare a table’s schema before inserting data. DINKAR THAKUR 3 SQL TERM MONGODB TERM database database table collection index index row document column field joining embedding & linking MongoDB’s collections do not enforce document structure. This means every row can have it’s own structure.
  • 4. Document Structure  MongoDB stores data in the form of documents, which are JSON-like objects and value pairs.  Documents are analogous to structures in programming languages that associate keys with values.  Formally, MongoDB documents are BSON (Binary representation of JSON) documents. DINKAR THAKUR 4 The field name _id is reserved for use as a primary key. Its value must be unique in the collection, is immutable, and may be of any type other than an array. The field names cannot start with the dollar sign ($) character. The field names cannot contain the dot (.) character. The field names cannot contain the null character
  • 5. Collections  MongoDB stores all documents in collections.  A collection is a group of related documents that have a set of shared common indexes.  Collections are analogous to a table in relational databases. DINKAR THAKUR 5 Now we Know the basic of MongoDB. Let’s start with it. You can follow installation instruction from http://docs.mongodb.org/manual/tutori al/install-mongodb-on-windows/
  • 6. Components :- mongod  mongod is the primary daemon process for the MongoDB system.  It handles data requests, manages data format, and performs background management operations. --help, -h Returns information on the options and use of mongod. --version Returns the mongod release number. --config <filename>, -f Specifies a configuration file for runtime configuration options. The configuration file is the preferred method for runtime configuration of mongod. The options are equivalent to the command-line configuration options. DINKAR THAKUR 6
  • 7. Components :- mongo and mongos  The mongo shell is an interactive JavaScript shell for MongoDB, and is part of all MongoDB distributions.  To display the database you are using, type db The command should return test, which is the default database. To switch databases, issue the use <db> command, like “use logdatabase”  To list the available databases, use the command show dbs. To access a different database from the current database without switching your current database context. Like “db.getSiblingDB('sampleDB').getCollectionNames()” DINKAR THAKUR 7 mongos for “MongoDB Shard,” is a routing service for MongoDB shard configurations that processes queries from the application layer, and determines the location of this data in the sharded cluster, in order to complete these operations. From the perspective of the application, a mongos instance behaves identically to any other MongoDB instance.
  • 8. MongoDB CRUD Introduction(Query)  In MongoDB a query targets a specific collection of documents.  Queries specify criteria, or conditions, that identify the documents that MongoDB returns to the clients.  A query may include a projection that specifies the fields from the matching documents to return.  You can optionally modify queries to impose limits, skips, and sort orders.  No Joins. DINKAR THAKUR 8
  • 9. Data Modification – Insert  Data modification refers to operations that create, update, or delete data.  In MongoDB, these operations modify the data of a single collection.  For the update and delete operations, you can specify the criteria to select the documents to update or remove. DINKAR THAKUR 9
  • 10. Update  Update operations modify existing documents in a collection.  In MongoDB, db.collection.update() and the db.collection.save() methods perform update operations.  The db.collection.update() method can accept query criteria to determine which documents to update as well as an option to update multiple rows. The following example finds all documents with type equal to "book" and modifies their qty field by -1. db.inventory.update({ type : "book" }, { $inc : { qty : -1 } }, { multi: true })  The save() method can replace an existing document. To replace a document with the save() method, pass the method a document with an _id field that matches an existing document. The following example completely replaces the document with the _id equal to 10 in the inventory collection db.inventory.save({ _id: 10, type: "misc", item: "placard" }) DINKAR THAKUR 10
  • 11. Read Read operations, or queries, retrieve data stored in the database. In MongoDB, queries select documents from a single collection.  For query operations, MongoDB provide a db.collection.find() method.  The method accepts both the query criteria and projections and returns a cursor to the matching documents. DINKAR THAKUR 11
  • 12. Delete The db.collection.remove() method removes documents from a collection.  You can remove all documents from a collection. db.inventory.remove({})  Remove all documents that match a condition. db.inventory.remove( { type : "food" } )  Limit the operation to remove just a single document. db.inventory.remove( { type : "food" }, 1 ) DINKAR THAKUR 12
  • 13. Continued…(Related Features)  Indexes :- MongoDB has full support for secondary indexes. These indexes allow applications to store a view of a portion of the collection in an efficient data structure. Most indexes store an ordered representation of all values of a field or a group of fields. Indexes may also enforce uniqueness, store objects in a geospatial representation, and facilitate text search.  Read Preference :- By default, an application directs its read operations to the primary member in a replica set. Reading from the primary guarantees that read operations reflect the latest version of a document. By distributing some or all reads to secondary members of the replica set, you can improve read throughput or reduce latency for an application that does not require fully up-to-date data. DINKAR THAKUR 13 Read Preference Mode Description primary Default mode. All operations read from the current replica set primary. primaryPreferred In most situations, operations read from the primary but if it is unavailable, operations read from secondary members. secondary All operations read from the secondary members of the replica set. secondaryPreferred In most situations, operations read from secondary members but if no secondary members are available, operations read from the primary. nearest Operations read from member of the replica set with the least network latency, irrespective of the member’s type.
  • 14. Continued…  Write Concern :- A write operation is any operation that creates or modifies data in the MongoDB instance. In MongoDB, write operations target a single collection. All write operations in MongoDB are atomic on the level of a single document. There are three classes of write operations in MongoDB: insert, update, and remove. Insert operations add new data to a collection. Update operations modify existing data, and remove operations delete data from a collection. No insert, update, or remove can affect more than one document atomically. DINKAR THAKUR 14
  • 16. Advanced Features  Indexing.  Writes and Reads using memory only and data persistence.  Write and Read Operations in a clustered environment.  Sharding (automatic and manual) and Reading.  Replication.  GridFS. DINKAR THAKUR 16
  • 17. Uses of MongoDB  MongoDB has a general-purpose design, making it appropriate for a large number of use cases.  Examples include content management systems, mobile applications, gaming, e-commerce, analytics, archiving, and logging.  Easy integration with C,C++, Java, GO, Node.js, Perl, PHP, Python, Ruby, Scala and C# We can even use LINQ and lambda syntax on the MongoDB result set. That’s a big advantage over other when .net is used. DINKAR THAKUR 17