Organizations face every day new challenges in order to continuously deliver new business functionality by implementing new It processes like Agile and DevOps and adopting new architectures such as cloud and microservices. To align with all these, we need a new database concept able to manage massive increases in rapidly changing data types and able to work with data wherever it stores in the client side and in the data layer side.
So the NoSQL databases “Not only SQL” are designed to respond to these challenges. MongoDB is the leading NoSQL database and an open-source document database.
In this article we will explain MongoDB concepts, give an idea on its advantages and terminology and where we can implement it.
MongoDB’s Advantages:
MongoDB’s data platform is based on two principles concepts:
- Document database: MongoDB uses the document as data model which is similar to JSON objects. It is a data structure composed of field and value pairs. The values may include sub-documents, arrays, and arrays of documents; which reduce the need for expensive joins. Using this data model it’s will be faster and easier to model how application objects will map to data since it corresponds to native data types . Beyond the ease-of-use, documents are flexible since we can modify our schema at any time, it is polymorphic because documents can have different structures compared to other documents in the same collection and it is extensible :we model data in any way application demands it.
- Distributed Data: MongoDB offers the ability to scale out the system and distribute data for low latency user access. Implementing “Sharding” and “Replica sets” techniques make it easy to distribute data and grow our deployment over inexpensive hardware.
Basics Terminology:
MongoDB stores BSON documents in collections; the collections in database. A single MongoDB server typically has multiple databases. Each database gets its own set of files on the file system as format of collections. Each collection is a set of documents . One of the collection’s major advantage is no enforcing of schemas and in the same time we have a 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.
The following figure shows the correspondence terminology of Relational Database with MongoDB:
Query Language:
Both RDBMS (Oracle and MySQL) and MongoDB have a rich query language.
The following figure shows the Query Language’s correspondence Of RDBMS and MongoDb:
Implementation:
To take advantage from MongoDB, we can choose implement MongoDB in these fields:
- E-commerce product catalog
- Blogs , content management and Delivery
- Mobile and Social Infrastructure
- Big Data
- User Data Management
- Data Hub