Out of many NoSQL database solutions available on the market, document database Mongo DB is certainly noteworthy. Its main features, owing to which the solution has gained popularity, include:
- Flexible data model based on BSON format (binary JSON)
- Simple query language – Mongo DB Query
- Data replication makes it possible to easily scale read operations
- Easy horizontal scaling by adding instances
Using a flexible data model based on BSON standard makes Mongo DB an ideal solution in cases where particular items differ in terms of attribute storage scope. Typical applications of Mongo DB include product catalogues, survey platforms, log collection and analysis systems or content management systems (CMS).
A wide range of supported access libraries allows integrating Mongo DB with most popular technologies used on the market, which along with the fast-growing community makes it possible to launch the solution at any organization.
Professional documentation with descriptions of many basic and advanced issues alike enables Mongo DB to be implemented with minimum effort put in learning the new technology.
The Mongo DB cluster uses two mechanisms:
each cluster element stores a fragment of data selected based on a key, which provides horizontal scaling
data is multiplied among replica set instances, which ensures high availability
Each replica set may contain instances of one of three types:
the main instance servicing all cluster entries which are then replicated to all secondary instances; only one primary instance may exist within one replica set
instances storing replicated data which enable reading; in the event of a primary instance malfunction, one of the secondary instances is automatically upgraded to operate in the primary mode
additional instance within the replica set which does not store data copies but it takes part in selecting a new primary instance
Instances of this sort are used when a replica set contains an even number of nods and at the same time there is no need to install another data copy
Horizontal scaling of the Mongo DB cluster is obtained by dividing a data set using a shard key. Choosing the appropriate shard key is one of the most important elements of cluster creation – an erroneous decision may result in excessive strain of particular cluster elements. Mongo DB offers two types of sharding:
sharding based on hashing functio
sharding based on key value ranges
Using the sharding and replication mechanisms makes it possible to create fully scalable and highly available solutions without using costly equipment. At the same time, because it is possible to install redundant instances for each component, proper configuration allows obtaining a solution devoid of bottlenecks and single points of failure (SPOF).
Failure handling procedures for particular cluster elements (failover) are fully automatic. Returning to normal operation (failback) and adding new cluster elements requires little effort on the part of the administrator and it is fully transparent to client applications. The above mentioned features allow building solutions with elevated availability times.
High performance and scalability of Mongo DB has been achieved at the expense of full transaction support. Mongo DB offers atomicity at the single document saving level. In the event of modifying multiple documents as part of one operation, there is a possibility of modifying via other threads. Partial support for transactional storage for multiple documents may be achieved by using the $isolated operator, yet this solution is not supported for the sharding-using cluster. Using extended transactions requires a rather cumbersome implementation on the application side, but owing to detailed pointers in the documentation, it should not pose a problem to an intermediate programmer.
Experience of the developing team and clearly defined development avenues cause Mongo DB to be considered a stable solution which may easily be implemented at any organization.
Let's talk business
Discover What’s Possible For Your Business.
Together we can solve it.