0% found this document useful (0 votes)
65 views

Mongo DB Session 01 Document

The document provides an introduction to MongoDB, a NoSQL database. It discusses that MongoDB is a document-oriented, open-source database written in C++. It then summarizes key topics about MongoDB including how to insert, update, delete, and query documents. The document also discusses MongoDB's support for different programming languages, history, advantages over RDBMS, and use cases.

Uploaded by

Arun Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views

Mongo DB Session 01 Document

The document provides an introduction to MongoDB, a NoSQL database. It discusses that MongoDB is a document-oriented, open-source database written in C++. It then summarizes key topics about MongoDB including how to insert, update, delete, and query documents. The document also discusses MongoDB's support for different programming languages, history, advantages over RDBMS, and use cases.

Uploaded by

Arun Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Mongo DB Session 01 Document

Page 1 of 10
Topics Covered

Page 2 of 10
Introduction to Mongo DB

MongoDB is a No SQL database. It is an open-source, cross-platform, document-oriented


database written in C++.

Our MongoDB tutorial includes all topics of MongoDB database such as insert documents,
update documents, delete documents, query documents, projection, sort() and limit() methods,
create a collection, drop collection, etc. There are also given MongoDB interview questions to
help you better understand the MongoDB database.

At the present time, the internet is loaded with big data, big users, big complexity etc. and also
becoming more complex day by day. NoSQL is answer of all these problems, It is not a
traditional database management system, not even a relational database management system
(RDBMS). NoSQL stands for "Not Only SQL". NoSQL is a type of database that can handle and
sort all type of unstructured, messy and complicated data. It is just a new way to think about
the database.

Yes. MongoDB is a NoSQL database.

What is MongoDB

MongoDB is an open-source document database that provides high performance, high


availability, and automatic scaling.

In simple words, you can say that - Mongo DB is a document-oriented database. It is an open
source product, developed and supported by a company named 10gen.

MongoDB is available under General Public license for free, and it is also available under
Commercial license from the manufacturer.

The manufacturing company 10gen has defined MongoDB as:

"MongoDB is a scalable, open source, high performance, document-oriented database." - 10gen

MongoDB was designed to work with commodity servers. Now it is used by the company of all
sizes, across all industry.

Different languages supported by MongoDB

MonggoDB provides official driver support for C, C++, C#, Java, Node.js, Perl, PHP, Python,
Ruby, Scala, Go and Erlang.

You can use MongoDB with any of the above languages. There are some other community
supported drivers too but the above mentioned ones are officially provided by MongoDB.

Page 3 of 10
History of MongoDB

The initial development of MongoDB began in 2007 when the company was building a platform
as a service similar to window azure.

Window azure is a cloud computing platform and infrastructure, created by Microsoft, to build,
deploy and manage applications and service through a global network.

MongoDB was developed by a NewYork based organization named 10gen which is now known
as MongoDB Inc. It was initially developed as a PAAS (Platform as a Service). Later in 2009, it is
introduced in the market as an open source database server that was maintained and supported
by MongoDB Inc.

The first ready production of MongoDB has been considered from version 1.4 which was
released in March 2010.

MongoDB2.4.9 version which was released on January 10, 2014.

MongoDB3.0.1 version which was released on March 17, 2015.

MongoDB4.0.1 version which was released on March 6, 2018.

MongoDB4.0.19 version which was released on Jun 15, 2020.

Purpose of building MongoDB

It may be a very genuine question that - "what was the need of MongoDB although there were
many databases in action?"

There is a simple answer:

All the modern applications require big data, fast features development, flexible deployment,
and the older database systems not competent enough, so the MongoDB was needed.

The primary purpose of building MongoDB is:

o Scalability
o Performance
o High Availability
o Scaling from single server deployments to large, complex multi-site architectures.
o Key points of MongoDB
o Develop Faster
o Deploy Easier

Page 4 of 10
o Scale Bigger

First of all, we should know what is document oriented database?

Example of document oriented database

MongoDB is a document oriented database. It is a key feature of MongoDB. It offers a document


oriented storage. It is very simple you can program it easily.

MongoDB stores data as documents, so it is known as document-oriented database.

1. FirstName = "John",                                                                                                             
2. Address = "Detroit",                                                                                                     
3. Spouse = [{Name: "Angela"}].                                                                                             
4. FirstName ="John",    
5. Address = "Wick"  

There are two different documents (separated by ".").

Storing data in this manner is called as document-oriented database.

Mongo DB falls into a class of databases that calls Document Oriented Databases. There is also a
broad category of database known as No SQL Databases.

Features of MongoDB

 Flexible data model in form of documents


 Agile and highly scalable database
 Faster than traditional databases
 Expressive query language

These are some important features of MongoDB:

1. Support ad hoc queries

In MongoDB, you can search by field, range query and it also supports regular expression
searches.

2. Indexing

You can index any field in a document.

3. Replication

MongoDB supports Master Slave replication.

Page 5 of 10
A master can perform Reads and Writes and a Slave copies data from the master and can only
be used for reads or back up (not writes)

4. Duplication of data

MongoDB can run over multiple servers. The data is duplicated to keep the system up and also
keep its running condition in case of hardware failure.

5. Load balancing

It has an automatic load balancing configuration because of data placed in shards.

6. Supports map reduce and aggregation tools.

7. Uses JavaScript instead of Procedures.

8. It is a schema-less database written in C++.

9. Provides high performance.

10. Stores files of any size easily without complicating your stack.

11. Easy to administer in the case of failures.

12. It also supports:

JSON data model with dynamic schemas

Auto-sharding for horizontal scalability

Built in replication for high availability

Now a day many companies using MongoDB to create new types of applications, improve
performance and availability.

NoSQL Databases

We know that MongoDB is a NoSQL Database, so it is very necessary to know about NoSQL
Database to understand MongoDB throughly.

What is NoSQL Database

Databases can be divided in 3 types:

Page 6 of 10
1. RDBMS (Relational Database Management System)
2. OLAP (Online Analytical Processing)
3. NoSQL (recently developed database)

NoSQL Database

NoSQL Database is used to refer a non-SQL or non relational database.

It provides a mechanism for storage and retrieval of data other than tabular relations model
used in relational databases. NoSQL database doesn't use tables for storing data. It is generally
used to store big data and real-time web applications.

History behind the creation of NoSQL Databases

In the early 1970, Flat File Systems are used. Data were stored in flat files and the biggest
problems with flat files are each company implement their own flat files and there are no
standards. It is very difficult to store data in the files, retrieve data from files because there is no
standard way to store data.

Then the relational database was created by E.F. Codd and these databases answered the
question of having no standard way to store data. But later relational database also get a
problem that it could not handle big data, due to this problem there was a need of database
which can handle every types of problems then NoSQL database was developed.

Advantages of NoSQL
o It supports query language.
o It provides fast performance.
o It provides horizontal scalability.

MongoDB advantages over RDBMS

In recent days, MongoDB is a new and popularly used database. It is a document based, non
relational database provider.

Although it is 100 times faster than the traditional database but it is early to say that it will
broadly replace the traditional RDBMS. But it may be very useful in term to gain performance
and scalability.

A Relational database has a typical schema design that shows number of tables and the
relationship between these tables, while in MongoDB there is no concept of relationship.

Page 7 of 10
MongoDB Advantages
o MongoDB is schema less. It is a document database in which one collection holds
different documents.
o There may be difference between number of fields, content and size of the
document from one to other.
o Structure of a single object is clear in MongoDB.
o There are no complex joins in MongoDB.
o MongoDB provides the facility of deep query because it supports a powerful dynamic
query on documents.
o It is very easy to scale.
o It uses internal memory for storing working sets and this is the reason of its fast access.

Distinctive features of MongoDB


o Easy to use
o Light Weight
o Extremely faster than RDBMS

Where MongoDB should be used


o Big and complex data
o Mobile and social infrastructure
o Content management and delivery
o User data management
o Data hub

Performance analysis of MongoDB and RDBMS


o In relational database (RDBMS) tables are using as storing elements, while in MongoDB
collection is used.
o In the RDBMS, we have multiple schema and in each schema we create tables to store
data while, MongoDB is a document oriented database in which data is written in BSON
format which is a JSON like format.
o MongoDB is almost 100 times faster than traditional database systems.

MongoDB Datatypes

Following is a list of usable data types in MongoDB.

Page 8 of 10
Data Types Description

String String is the most commonly used datatype. It is used to store data. A string
must be UTF 8 valid in mongodb.

Integer Integer is used to store the numeric value. It can be 32 bit or 64 bit
depending on the server you are using.

Boolean This datatype is used to store boolean values. It just shows YES/NO values.

Double Double datatype stores floating point values.

Min/Max This datatype compare a value against the lowest and highest bson
Keys elements.

Arrays This datatype is used to store a list or multiple values into a single key.

Object Object datatype is used for embedded documents.

Null It is used to store null values.

Symbol It is generally used for languages that use a specific type.

Date This datatype stores the current date or time in unix time format. It makes
you possible to specify your own date time by creating object of date and
pass the value of date, month, year into it.

Session I

1) What do you understand by NoSQL databases? Is MongoDB a NoSQL


database? explain.
2) What is MongoDB?

Page 9 of 10
3) Which are the different languages supported by MongoDB?
4) What is the purpose of building MongoDB?
5) Explain about document oriented database?
6) What are the futures of MongoDB?
7) What is NoSQL Database?
8) How many types of NoSQL Database?
9) What are the advantages of NoSQL?
10) What are the advantages of MongoDB?
11) What are the Distinctive advantages of MongoDB?
12) Where MongoDB Should be used?
13) Performance analysis of MongoDB & RDBMS?

Page 10 of 10

You might also like