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

MongoDB Document

MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling. It uses a document-oriented data model where records are stored as documents consisting of key-value pairs. Documents can contain other documents, arrays, and varied data types. MongoDB is horizontally scalable and offers replication for high availability. Its dynamic schema supports flexible, nested data structures and complex queries.

Uploaded by

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

MongoDB Document

MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling. It uses a document-oriented data model where records are stored as documents consisting of key-value pairs. Documents can contain other documents, arrays, and varied data types. MongoDB is horizontally scalable and offers replication for high availability. Its dynamic schema supports flexible, nested data structures and complex queries.

Uploaded by

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

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

high availability, and automatic scaling. A record in MongoDB is a document, which


is a data structure composed of field and value pairs (Key:Value pair). MongoDB
documents are similar to JSON objects. The values of fields may include other
documents, arrays and arrays of documents.

The advantages of using documents are:


1) Documents (i.e. objects) correspond to native data types in many programming
languages.
2) Embedded documents and arrays reduce need for expensive joins.
3) Dynamic schema supports fluent polymorphism.

Key Features of MongoDB


1) High Performance – MongoDB provides high performance data persistence. In
particular, it supports for embedded data models reduces I/O activity on database
system, indexes support faster queries and can include keys from embedded
documents and arrays.
2) Rich Query Language - MongoDB supports a rich query language to support read
and write operations (CRUD) as well as data aggregation and text searching.
3) High Availability – MongoDb’s replication facility, called replica set, provides
automatic failover and data redundancy. A replica set is a group of MongoDB servers
that maintain the same data set, providing redundancy and increasing data availability.
4) Horizontal Scalability – MongoDB provides horizontal scalability as part of its
core functionality. Sharding distributes data across a cluster of machines.

MongoDB Features
1) Each database contains collections which in turn contains documents. Each
document can be different with a varying number of fields. The size and content of
each document can be differe nt from each other.
2) The document structure is more in line with how developers construct their classes
and objects in their respective programming languages. Developers will often say that
their classes are not rows and columns but have a clear structure with key-value pairs.
3) The rows (or documents as called in MongoDB) doesn’t need to have a schema
defined beforehand. Instead, the fields can be created on the fly.
4) The data model available within MongoDB allows you to represent hierarchical
relationships, to store arrays, and other more complex structures more easily.
5) Scalability – The MongoDB environments are very scalable. Companies across the
world have defined clusters with some of them running 100+ nodes with around
millions of documents within the database

Overview

MongoDB is an open-source document database and leading NoSQL database.


MongoDB is written in C++. MongoDB is a cross-platform, document oriented
database that provides high performance, high availability and easy scalability.
MongoDB works on concept of collection and document
Database - Database is a physical container for collections. Each database gets its
own set of files on the file system.
Collection - Collection is a group of MongoDB documents. It is the equivalent of a
RDBMS table. Collections do not enforce a schema. Documents within a collection
can have different fields. Typically, all documents in a collection are of similar or
related purpose.
Document - A document is a set of key- value pairs. Documents 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.

Sample Document

Above example shows the document structure of a blog site, which is simply a
comma separated key value pair.

Advantages of MongoDB
Any 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. Advantages of MongoDB over RDBMS can be described as:

1) MongoDB is a document database in which one collection holds different


documents. Number of fields, content and size of the document can differ from one
document to another.
2) Structure of a single object is clear.
3) No complex joins.
4) Deep query ability. MongoDB supports dynamic queries on documents using a
document-based query language that’s nearly as powerful as SQL.
5) Ease of scale out. MongoDB is easy to scale.
6) Conversion/mapping of application objects to database objects not needed.
7) Uses internal memory for storing the (windowed) working set, enabling faster
access of data.
Applications of MongoDB

MongoDB has document oriented storage; data is stored in the form of JSON style
documents. It can be indexed on any attributes. We can also explain where to use
MongoDB:

 Big Data
 Content Management and Delivery
 Mobile and Social Infrastructure
 User Data Management
 Data Hub

You might also like