This document provides an introduction to NoSQL and MongoDB. It outlines that NoSQL databases are used to manage unstructured data and overcome limitations of relational databases. MongoDB is introduced as a popular document-oriented NoSQL database that stores data as JSON-like documents. Key features of MongoDB include high performance, scalability, rich query language, and automatic replication for high availability.
3. Introduction to NoSQL
• a database used to manage huge sets of
unstructured data, where in the data is not
stored in tabular relations like relational
databases
2/15/2018 3
4. Introduction to NoSQL
• NoSQL database is designed to overcome the
Performance, Scalability, Data Modelling and
Distribution limitations that are seen in the
Relational Databases.
2/15/2018 4
5. What is Structured Data?
• Structured data is usually text files, with
defined column titles and data in rows. Such
data can easily be visualized in form of charts
and can be processed using data mining tools.
2/15/2018 5
6. What is Unstructured Data?
• Unstructured data can be anything like video file,
image file, PDF, Emails etc. What does these files
have in common, nothing.
• Structured Information can be extracted from
unstructured data, but the process is time
consuming. And as more and more modern data is
unstructured, there was a need to have something to
store such data for growing applications, hence
setting path for NoSQL.
2/15/2018 6
9. Dynamic Schemas
• In Relational Databases like Oracle, MySQL we define
table structures, right?
• For example, if we want to save records of Student
Data, then we will have to create a table named
Student, add columns to it, like student_id,
student_name etc, this is called defined schema,
where in we define the structure before saving any
data.
2/15/2018 9
10. Dynamic Schemas con…
• If in future we plan to add some more related data in
our Student table, then we will have to add a new
column to our table. Which is easy, if we have less
data in our tables, but what if we have millions of
records. Migration to the updated schema would be
a hectic job.
• NoSQL databases solve this problem, as in a NoSQL
database, schema definition is not required.
2/15/2018 10
11. Sharding
• In Sharding, large databases are partitioned into small,
faster and easily manageable databases.
• The (classic) Relational Databases follow a vertical
architecture where in a single server holds the data, as
all the data is related.
• Relational Databases does not provide Sharding feature
by default, to achieve this a lot of efforts has to be put
in, because transactional integrity(Inserting/Updating
data in transactions), multiple table JOINS etc cannot
be easily achieved in distributed architecture in case of
Relational Databases
2/15/2018 11
12. Sharding con…
• NoSQL Databases have the Sharding feature as
default. No additional efforts required. They
automatically spread the data across servers,
fetch the data in the fastest time from the
server.
2/15/2018 12
13. Replication
• Auto data replication is also supported in
NoSQL databases by default. Hence, if one DB
server goes down, data is restored using its
copy created on another server in network
2/15/2018 13
14. Integrated Caching
• Many NoSQL databases have support for
Integrated Caching, where in the frequently
demanded data is stored in cache to make the
queries faster.
2/15/2018 14
15. CAP theory for NoSQL
• Consistency
• Availability
• Partitioning tolerance
• How it is interpreted:
– You must always give something up: consistency,
availability or tolerance to failure and
reconfiguration
17. MongoDB - NoSQL Database
• is a NoSQL database written in C++ language.
• stores the data in form of key-value pairs.
• MongoDB is a document oriented database where it
stores data in collections instead of tables.
• The best part of MongoDB is that the drivers are
available for almost all the popular programming
languages.
2/15/2018 17
18. MongoDB - NoSQL Database Con…
• provides high performance and scalability along with
data modelling and data management of huge sets of
data in an enterprise application.
• provides the feature of Auto-Scaling.
• MongoDB is a cross platform database and can be
installed across different platforms like Windows,
Linux etc.
2/15/2018 18
19. Document based storage
• A Document is nothing but a data structure with name-
value pairs like in JSON. It is very easy to map any custom
Object of any programming language with a MongoDB
Document.
• For example : Student object has attributes name , rollno
and subjects , where subjects is a List.
• Document for Student in MongoDB will be like :
{
name : "Stduytonight",
rollno : 1,
subjects : ["C Language", "C++", "Core Java"]
}
2/15/2018 19
20. Key Features of MongoDB
• MongoDB provides high performance.
• Input/output operations are lesser than relational databases due
to support of embedded documents(data models) and Select
queries are also faster as Indexes in MongoDB supports faster
queries.
2/15/2018 20
21. Key Features of MongoDB
• MongoDB has a rich Query Language
• supporting all the major CRUD operations. The Query Language
also provides good Text Search and Aggregation features.
• Horizontal Scalability is possible due to Sharding.
• Auto Replication feature of MongoDB leads to High
Availability.
• It provides an automatic failover mechanism, as data is restored
through backup(replica) copy if server fails
2/15/2018 21
22. Organizations that use MongoDB
• some of the big and notable organizations
which are using MongoDB as database for
most of their business applications.
– Adobe
– LinkedIn
– McAfee
– Four Square
– eBay
– SAP
2/15/2018 22
23. Install
• Download and install suitable package for
each platform [Windows, Linux, Mac OSX,
Solaris]
• Create a folder e.g. C:mongodb
• Go to bin of installation folder.
• Run mongod.exe then mongo.exe
• Make sure that mongod.exe (MongoDB
Server) is running without any problems
before running mongo.exe
25. Processes & configuration
• Mongod – Database instance
– It is the primary daemon process for the
MongoDB system. It handles data requests,
manages data access, and performs background
management operations
• Mongos – Sharding processes
• Mongo – an interactive shell ( a client)
– Fully functional JavaScript environment for use
with a MongoDB
26. The mongo shell
• The mongo shell is an interactive JavaScript
interface to MongoDB.
• We can use the mongo shell to query and
update data as well as perform administrative
operations
2/15/2018 26
Editor's Notes
You must be wondering what does dynamic schema means? In Relational Databases like Oracle, MySQL we define table structures, right? For
example, if we want to save records of Student Data, then we will have to create a table named Student, add columns to it, like student_id,
student_name etc, this is called defined schema, where in we define the structure before saving any data.
If in future we plan to add some more related data in our Student table, then we will have to add a new column to our table. Which is easy, if we have
less data in our tables, but what if we have millions of records. Migration to the updated schema would be a hectic job. NoSQL databases solve this
problem, as in a NoSQL database, schema definition is not required
----------------------------