SlideShare a Scribd company logo
Big Data Systems
Webinar 1-MongoDB
Agenda
Introduction
Architecture
Important Features
NoSQL Database
MongoDB Vs RDBMS
Installation Process
CRUD Operations
MongoDB- Replication & Aggregation
Introduction
MongoDB is a cross-platform, document oriented database
It is a NoSQL database
It is open source
It provides high performance and scalability
It stores data in the form of key/value pairs (document)
It eliminates the need for Object Relational Mapping (ORM) in database development
MOngoDB stores data in form of BSON (binary JavaScript Object Notation) documents
{
name: “travis”,
salary: 30000,
designation: “Computer Scientist”,
teams: [ “front-end”, “database” ]
}
MongoDB Architecture [1]
Important Features of MongoDB?
•Queries support: MongoDB supports ad-hoc and document-based queries.
•Index Support: All fields in the document are indexed.
•Replication: MongoDB possesses Master-Slave replication. It uses a native
application to preventing database downtime by maintaining multiple copies of
data.
•Multiple Servers: Duplicate data that is stored in the database is run over multiple
servers to avoid the damage caused due to hardware failure.
•Auto-sharding: The data is being distributed among several physical partitions
known as shards. MongoDB has an in-built feature called automatic load balancing.
•MapReduce: It is a flexible aggregation tool that supports the MapReduce
function.
•Failure Handling: In MongoDB, works effectively in case of failures such as
multiple machine failures, data center failures by protecting data and making it
available.
•GridFS: This feature will allow the files to divide into smaller parts and store them
in different documents without complicating the stack.
•Schema-less Database: MongoDB is a schema-less database programmed in C++
language.
•Document-oriented Storage: It uses BSON format which is similar to JSON
•Procedures: MongoDB JavaScript works better than procedures as databases use
the language more than procedures.
NoSQL Database
•It is a non-relational database.
• No need to create tables, relations for storing data .
•This type of database is used to store web applications or large databases.
RDBMS vs MongoDB
MongoDB does not have schema: We can insert the data in any order.
◦ We can see in the screenshot that the first collection (tuple) in the document (table) newdb the first tuple
has fields name and age while the second tuple had gender and name it is not mandatory to maintain a
structure in MongoDB.
Sample MongoDB Query
MongoDB Datatypes
Key Terms
Collection
◦ It is a group of MongoDB documents.
◦ It is the equivalent of an RDBMS table.
◦ A collection exists within a single database.
◦ Collections do not enforce a schema.
◦ Documents within a collection can have different fields.
Document
◦ A document is a set of key-value pairs.
◦ It have dynamic schema.
◦ Dynamic schema means that documents in the same collection do not need to have the same set of
fields or structure, and common fields in a collection's documents may hold different types of data.
Installation Process
Cloud : MongoDB Atlas
Stand-alone system – link
 Install shell
 Install compass
 Install data tool (if needed)
Execution Process
◦ Run MongoDB’s database server from command prompt
◦ If we run the command “mongod”, it will activate the mongoDB database server which is running at port 27017.
◦ Run MongoDB’s shell
◦ We run the “mongo” file, which is the MongoDB Shell, from a new command prompt window.
◦ This is where we feed the database server with commands such as creating a database or a collection and dropping collections.
Create Database
MongoDB uses the ‘use’ command to create a database.
If the database exists already, then it will be returned. Otherwise, a new database with the given
database name will be created.
Syntax: use <DATABASE_NAME>
Example : To create a database ‘movie’.
◦ use movie //This will create a new database called ‘movie’.
Drop Database
MongoDB uses the ‘db.dropDatabase()’ command to drop a database.
If the database exists already, then it will be dropped and true will be returned. Otherwise,
nothing will be dropped and 0 will be returned.
Syntax: db.dropDatabase()
Example:
◦ db.dropDatabase ()
Create Collection
A collection is what is referred to as a table in normal RDBMS.
It stores documents which may not be in the same structure.
A collection has various options such as setting maximum size and validating rules.
Syntax:
db.createCollection(name,options)
◦ Parameter :Name
This field is used to specify the name of the collection which you are creating.
◦ Parameter :Options
This field is used to specify particular configurations for the collection which you
have created.
Example
To create a database ‘movie’.
use movie //This will create a new database called ‘movie’.
To create collection ‘KMovies’
db.createCollection("KMovies", { capped : true, autoIndexId : true,
size :6142800, max : 10000 } )
This will now create a collection KMovies which is capped, auto indexed with specified size and
specified maximum number of documents.
This will now create a collection KMovies with capping, auto indexing, we will set the size to
6124800 and we will set the maximum number of documents to 10000.
Drop Collection
Since there are several collections in a particular database, we need to specify to MongoDB which collection we
are aiming to drop.
We use “show collections” to find out which all collections we have in our database.
Syntax: db.COLLECTION_NAME.drop()
Example : db.KMovies.drop()
Insert Document
This is used to insert several documents(tuples) into a collection(table)
If the collection is not available a new collection is created with the specified collection name
and documents are inserted into it.
Syntax
◦ db.collection_name.insert(document)
◦ // document parameter includes the column name and their values respectively, the rows are separated using {} and comma
operators.
Code
db.list.insert ([{‘movie’:’kathi’, ’actor’:’vijay’,’director’:’armurgadass’},
{‘movie’:’vedhalam’,’actor’:’ajith’,’director’:’siva’},
{‘movie’:’mass’,’actor’:’surya’,’director’:’venkatprabhu’},
{‘movie’:’theri’,’actor’:’vijay’,’director’:’atlee’}])
o/p
Query Document
Find() Command
Syntax
db.collection_name.find()
//where collection_name(table name) is the name of the collection.
Code & O/P
db.list.find()
Pretty() Command
This is used to display the contents of collection in a formatted way.
Syntax
◦ db.collection_name.find().pretty()
◦ //where collection_name(table name) is the name of the collection.
Code and O/P
db.list.find.pretty()
Code and O/P
db.list.update({‘movie’:’theri’},{$set:{‘movie’:’vijay61’}})
//using which the column movie with theri is replaced by vijay61.
Delete Document
This is used to delete the value of a certain column in a collection
Syntax
db.collection_name.remove(selection_criteria)
//where collection_name(table name) is the name of the collection, selection_criteria is which value should be deleted.

More Related Content

Similar to MongoDB introduction features -presentation - 2.pptx (20)

PPTX
Introduction to MongoDB.pptx
Surya937648
 
PDF
MongoDB Interview Questions PDF By ScholarHat
Scholarhat
 
PPTX
MongoDB.pptx
Sigit52
 
PDF
Mongodb Introduction
Raghvendra Parashar
 
PPTX
Mongo db Quick Guide
Sourabh Sahu
 
PDF
MongoDB Interview Questions PDF By ScholarHat
Scholarhat
 
PPTX
Mongodb Introduction
Nabeel Naqeebi
 
PDF
Mongodb
Apurva Vyas
 
PPTX
MongoDB for Beginners
Enoch Joshua
 
PDF
Mongodb tutorial
Ashoka Vanjare
 
PDF
MongoDB NoSQL database a deep dive -MyWhitePaper
Rajesh Kumar
 
PPTX
Introduction To MongoDB
ElieHannouch
 
PPT
Introduction to mongodb
neela madheswari
 
PPTX
MongoDB is a document database. It stores data in a type of JSON format calle...
amintafernandos
 
PPTX
Getting Started with MongoDB
Ahasanul Kalam Akib
 
PPTX
MongoDB_ppt.pptx
1AP18CS037ShirishKul
 
PDF
3-Mongodb and Mapreduce Programming.pdf
MarianJRuben
 
PPTX
Introduction to MongoDB a brief intro(1).pptx
mehfooz968268
 
PPTX
MongoDB
nikhil2807
 
Introduction to MongoDB.pptx
Surya937648
 
MongoDB Interview Questions PDF By ScholarHat
Scholarhat
 
MongoDB.pptx
Sigit52
 
Mongodb Introduction
Raghvendra Parashar
 
Mongo db Quick Guide
Sourabh Sahu
 
MongoDB Interview Questions PDF By ScholarHat
Scholarhat
 
Mongodb Introduction
Nabeel Naqeebi
 
Mongodb
Apurva Vyas
 
MongoDB for Beginners
Enoch Joshua
 
Mongodb tutorial
Ashoka Vanjare
 
MongoDB NoSQL database a deep dive -MyWhitePaper
Rajesh Kumar
 
Introduction To MongoDB
ElieHannouch
 
Introduction to mongodb
neela madheswari
 
MongoDB is a document database. It stores data in a type of JSON format calle...
amintafernandos
 
Getting Started with MongoDB
Ahasanul Kalam Akib
 
MongoDB_ppt.pptx
1AP18CS037ShirishKul
 
3-Mongodb and Mapreduce Programming.pdf
MarianJRuben
 
Introduction to MongoDB a brief intro(1).pptx
mehfooz968268
 
MongoDB
nikhil2807
 

Recently uploaded (20)

PPTX
Introduction-to-Python-Programming-Language (1).pptx
dhyeysapariya
 
PPT
Real Life Application of Set theory, Relations and Functions
manavparmar205
 
PPTX
Presentation (1) (1).pptx k8hhfftuiiigff
karthikjagath2005
 
PPTX
MR and reffffffvvvvvvvfversal_083605.pptx
manjeshjain
 
PPTX
Future_of_AI_Presentation for everyone.pptx
boranamanju07
 
PPT
From Vision to Reality: The Digital India Revolution
Harsh Bharvadiya
 
DOCX
Q1_LE_Mathematics 8_Lesson 4_Week 4.docx
ROWELLJAYMALAPIT
 
PPTX
7 Easy Ways to Improve Clarity in Your BI Reports
sophiegracewriter
 
PDF
SUMMER INTERNSHIP REPORT[1] (AutoRecovered) (6) (1).pdf
pandeydiksha814
 
PDF
Blitz Campinas - Dia 24 de maio - Piettro.pdf
fabigreek
 
DOCX
Online Delivery Restaurant idea and analyst the data
sejalsengar2323
 
PDF
apidays Munich 2025 - The Double Life of the API Product Manager, Emmanuel Pa...
apidays
 
PPTX
Nursing Shift Supervisor 24/7 in a week .pptx
amjadtanveer
 
PPTX
Solution+Architecture+Review+-+Sample.pptx
manuvratsingh1
 
PPTX
Multiscale Segmentation of Survey Respondents: Seeing the Trees and the Fores...
Sione Palu
 
PPTX
M1-T1.pptxM1-T1.pptxM1-T1.pptxM1-T1.pptx
teodoroferiarevanojr
 
PDF
717629748-Databricks-Certified-Data-Engineer-Professional-Dumps-by-Ball-21-03...
pedelli41
 
PDF
An Uncut Conversation With Grok | PDF Document
Mike Hydes
 
PDF
blockchain123456789012345678901234567890
tanvikhunt1003
 
PPTX
The whitetiger novel review for collegeassignment.pptx
DhruvPatel754154
 
Introduction-to-Python-Programming-Language (1).pptx
dhyeysapariya
 
Real Life Application of Set theory, Relations and Functions
manavparmar205
 
Presentation (1) (1).pptx k8hhfftuiiigff
karthikjagath2005
 
MR and reffffffvvvvvvvfversal_083605.pptx
manjeshjain
 
Future_of_AI_Presentation for everyone.pptx
boranamanju07
 
From Vision to Reality: The Digital India Revolution
Harsh Bharvadiya
 
Q1_LE_Mathematics 8_Lesson 4_Week 4.docx
ROWELLJAYMALAPIT
 
7 Easy Ways to Improve Clarity in Your BI Reports
sophiegracewriter
 
SUMMER INTERNSHIP REPORT[1] (AutoRecovered) (6) (1).pdf
pandeydiksha814
 
Blitz Campinas - Dia 24 de maio - Piettro.pdf
fabigreek
 
Online Delivery Restaurant idea and analyst the data
sejalsengar2323
 
apidays Munich 2025 - The Double Life of the API Product Manager, Emmanuel Pa...
apidays
 
Nursing Shift Supervisor 24/7 in a week .pptx
amjadtanveer
 
Solution+Architecture+Review+-+Sample.pptx
manuvratsingh1
 
Multiscale Segmentation of Survey Respondents: Seeing the Trees and the Fores...
Sione Palu
 
M1-T1.pptxM1-T1.pptxM1-T1.pptxM1-T1.pptx
teodoroferiarevanojr
 
717629748-Databricks-Certified-Data-Engineer-Professional-Dumps-by-Ball-21-03...
pedelli41
 
An Uncut Conversation With Grok | PDF Document
Mike Hydes
 
blockchain123456789012345678901234567890
tanvikhunt1003
 
The whitetiger novel review for collegeassignment.pptx
DhruvPatel754154
 
Ad

MongoDB introduction features -presentation - 2.pptx

  • 2. Agenda Introduction Architecture Important Features NoSQL Database MongoDB Vs RDBMS Installation Process CRUD Operations MongoDB- Replication & Aggregation
  • 3. Introduction MongoDB is a cross-platform, document oriented database It is a NoSQL database It is open source It provides high performance and scalability It stores data in the form of key/value pairs (document) It eliminates the need for Object Relational Mapping (ORM) in database development
  • 4. MOngoDB stores data in form of BSON (binary JavaScript Object Notation) documents { name: “travis”, salary: 30000, designation: “Computer Scientist”, teams: [ “front-end”, “database” ] }
  • 6. Important Features of MongoDB? •Queries support: MongoDB supports ad-hoc and document-based queries. •Index Support: All fields in the document are indexed. •Replication: MongoDB possesses Master-Slave replication. It uses a native application to preventing database downtime by maintaining multiple copies of data. •Multiple Servers: Duplicate data that is stored in the database is run over multiple servers to avoid the damage caused due to hardware failure. •Auto-sharding: The data is being distributed among several physical partitions known as shards. MongoDB has an in-built feature called automatic load balancing. •MapReduce: It is a flexible aggregation tool that supports the MapReduce function.
  • 7. •Failure Handling: In MongoDB, works effectively in case of failures such as multiple machine failures, data center failures by protecting data and making it available. •GridFS: This feature will allow the files to divide into smaller parts and store them in different documents without complicating the stack. •Schema-less Database: MongoDB is a schema-less database programmed in C++ language. •Document-oriented Storage: It uses BSON format which is similar to JSON •Procedures: MongoDB JavaScript works better than procedures as databases use the language more than procedures.
  • 8. NoSQL Database •It is a non-relational database. • No need to create tables, relations for storing data . •This type of database is used to store web applications or large databases.
  • 10. MongoDB does not have schema: We can insert the data in any order. ◦ We can see in the screenshot that the first collection (tuple) in the document (table) newdb the first tuple has fields name and age while the second tuple had gender and name it is not mandatory to maintain a structure in MongoDB.
  • 13. Key Terms Collection ◦ It is a group of MongoDB documents. ◦ It is the equivalent of an RDBMS table. ◦ A collection exists within a single database. ◦ Collections do not enforce a schema. ◦ Documents within a collection can have different fields. Document ◦ A document is a set of key-value pairs. ◦ It have dynamic schema. ◦ Dynamic schema means that documents in the same collection do not need to have the same set of fields or structure, and common fields in a collection's documents may hold different types of data.
  • 14. Installation Process Cloud : MongoDB Atlas Stand-alone system – link  Install shell  Install compass  Install data tool (if needed)
  • 15. Execution Process ◦ Run MongoDB’s database server from command prompt ◦ If we run the command “mongod”, it will activate the mongoDB database server which is running at port 27017.
  • 16. ◦ Run MongoDB’s shell ◦ We run the “mongo” file, which is the MongoDB Shell, from a new command prompt window. ◦ This is where we feed the database server with commands such as creating a database or a collection and dropping collections.
  • 17. Create Database MongoDB uses the ‘use’ command to create a database. If the database exists already, then it will be returned. Otherwise, a new database with the given database name will be created. Syntax: use <DATABASE_NAME> Example : To create a database ‘movie’. ◦ use movie //This will create a new database called ‘movie’.
  • 18. Drop Database MongoDB uses the ‘db.dropDatabase()’ command to drop a database. If the database exists already, then it will be dropped and true will be returned. Otherwise, nothing will be dropped and 0 will be returned. Syntax: db.dropDatabase() Example: ◦ db.dropDatabase ()
  • 19. Create Collection A collection is what is referred to as a table in normal RDBMS. It stores documents which may not be in the same structure. A collection has various options such as setting maximum size and validating rules.
  • 20. Syntax: db.createCollection(name,options) ◦ Parameter :Name This field is used to specify the name of the collection which you are creating. ◦ Parameter :Options This field is used to specify particular configurations for the collection which you have created.
  • 21. Example To create a database ‘movie’. use movie //This will create a new database called ‘movie’. To create collection ‘KMovies’ db.createCollection("KMovies", { capped : true, autoIndexId : true, size :6142800, max : 10000 } ) This will now create a collection KMovies which is capped, auto indexed with specified size and specified maximum number of documents.
  • 22. This will now create a collection KMovies with capping, auto indexing, we will set the size to 6124800 and we will set the maximum number of documents to 10000.
  • 23. Drop Collection Since there are several collections in a particular database, we need to specify to MongoDB which collection we are aiming to drop. We use “show collections” to find out which all collections we have in our database. Syntax: db.COLLECTION_NAME.drop() Example : db.KMovies.drop()
  • 24. Insert Document This is used to insert several documents(tuples) into a collection(table) If the collection is not available a new collection is created with the specified collection name and documents are inserted into it. Syntax ◦ db.collection_name.insert(document) ◦ // document parameter includes the column name and their values respectively, the rows are separated using {} and comma operators.
  • 26. o/p
  • 27. Query Document Find() Command Syntax db.collection_name.find() //where collection_name(table name) is the name of the collection.
  • 29. Pretty() Command This is used to display the contents of collection in a formatted way. Syntax ◦ db.collection_name.find().pretty() ◦ //where collection_name(table name) is the name of the collection.
  • 32. Delete Document This is used to delete the value of a certain column in a collection Syntax db.collection_name.remove(selection_criteria) //where collection_name(table name) is the name of the collection, selection_criteria is which value should be deleted.