MongoDB Database
Increase your technical knowledge through our FSH Infotech Blog section.
We add various blog categories that is related to IT technologies.
You can find more blogs added by our administrator by using the below link. Click here for more blogs
Short Description
MongoDB is an open-source document-based database. It is a trending NoSQL database used in the market right now to develop modern applications. It is written in C++. It works on the concept of collections and documents.
Features of MongoDB
1) Cross Platform
2) Document based
3) High performance
4) Scalability
Collections and Documents
A collection is group of documents. It is similar to the table in a RDBMS database, whereas a document is a set of keys and values, it is similar to the row in RDBMS database.
The following table shows the relationship of RDBMS terminology with MongoDB.
RDBMS | MongoDB |
Database | Database |
Table | Collection |
Row | Document |
Column | Field |
A sample document of a mongodb collection looks like below:
{
_id: ObjectId(3df08ad1902c)
title: 'MongoDB DB',
description: 'MongoDB is no sql database',
tags: ['mongodb', 'database', 'NoSQL'],
user_likes: [
{
user:'user_x',
like: 51
},
{
user:'user_y',
like: 5
}
]
}
A unique id will be attached to every document of a MongoDB collection to identify that document.
Advantages of MongoDB
Schema less: There may not be a schema due to its document-holding pattern.
No joins: There are no complex joins, an inbuilt methods are available to get data from many collections.
Scaling: This database is very easy to scale because it contains JSON.
More information and features
Ad-hoc queries:
MongoDB supports field, range queries, and regular expressions.Queries can return specific fields of documents and also include user-defined javascript functions.
Indexing:
Fields in a MongoDB document can be indexed with primary and secondary indices or indexes.
Load balancing:
MongoDB scales horizontally by concept of sharding.
The user chooses a shard key, which determines how a collection data can be distrubuted across multiple machines. Based on the shard key the data will be split into ranges and distributed across multiple shards.
A shard is a master with one or more replicas. A shard key can also be hased.
MongoDB can run over multiple servers, can load balance or duplicating data to keep the system up and running in case of hardware failure.
For more details information go through the below links and videos:
Imp Links:
MongoDB official website : https://www.mongodb.com/
MongoDB Official Docs : https://www.mongodb.com/docs/
MongoDB wikipedia source : https://en.wikipedia.org/wiki/MongoDB
MongoDB youtube video source: https://www.youtube.com/watch?v=pWbMrx5rVBE&t=274s