Hello friends... In our last discussion we have covered how the distributed architecture will give better performance for all the BIG data solution and NoSQL technologies. In this post we will cover various aspects of MongoDB which make the difference.
Ease of Use:
At the very core of its architecture MongoDB is a document-oriented database and not a relational one. The main reason of moving away from a relational structure is to make the scale out easier though that brings other advantages as well.
MongoDB replaces the concept of "row" with a concept of "Document". A document is nothing but a java script object formatted string (JSON) with a Key-Value structure, that allows embedding of child document and arrays. This makes any hierarchical relationship in a single record.
Think of a scenario, where you want to find a full hierarchy of any structure starting from any of the child node traversing to its root. You use CONNECT BY PRIOR query right? ... Which itself is a very costly one. This will be far more faster in MongoDB with this document structure.
Schema Less:
With your relational database you define a schema first before you start doing any development. Now keeping today's development agility in mind (where change is the only constant) we cannot avoid changes in our data model as we move forward towards the development life cycle. And this would obviously impact your application layer.
MongoDB is schema less. You don't have to restrict yourself in a strict definition. The document's keys and values are not of fixed size and type. Addition and removal of keys also become easier with makes the development faster.
Easy Scaling:
We have already discussed how scale out provides better performance. MongoDB has been designed to scale out. The document-oriented data structure makes it easier to split one record across multiple servers. The database automatically takes care takes care of balancing the data and load across a cluster, redistributing documents automatically and routing user requests to the correct machines. So the developers can focus on programming the application, not scaling it. When a cluster need more capacity, new machines can be added and MongoDB will figure out how the existing data should be spread to them.
Indexing:
MongoDB is designed to support generic secondary indexes, allowing a variety of fast queries. This provides unique, compound and full text indexes. One of the unique feature of MongoDB is to support geospatial indexes.
Aggregation:
MongoDB supports a pipeline concept to build complex aggregation from simple pieces and allow the database to optimize it. This helps the user to implement complex logic, filter, sort, skip, limit in one query.
Special Collection:
In MongoDB a table (in RDBMS) is known as a Collection. MongoDB supports time-to-live collections for data that should expire at a certain time, such as sessions. Fixed-size collections, which are useful for holding recent data, such as logs are also supported.
Other than these unique features other common features like Replication, Backup & Recovery, Monitoring statistics, Security and User Administration are also supported here.
As we pointed out earlier two main features of a relational DB namely join and multi-document transaction is not supported in MongoDB. There are provisions and recommendations on how to address these "limitation"s. The schema design of MongoDB plays a major role in it and that will answer your question.
Before going to the schema design we will quickly touch upon some of the MongoDB nomenclature and practicals.
<< Prev Next >>
Ease of Use:
At the very core of its architecture MongoDB is a document-oriented database and not a relational one. The main reason of moving away from a relational structure is to make the scale out easier though that brings other advantages as well.
MongoDB replaces the concept of "row" with a concept of "Document". A document is nothing but a java script object formatted string (JSON) with a Key-Value structure, that allows embedding of child document and arrays. This makes any hierarchical relationship in a single record.
Think of a scenario, where you want to find a full hierarchy of any structure starting from any of the child node traversing to its root. You use CONNECT BY PRIOR query right? ... Which itself is a very costly one. This will be far more faster in MongoDB with this document structure.
Schema Less:
With your relational database you define a schema first before you start doing any development. Now keeping today's development agility in mind (where change is the only constant) we cannot avoid changes in our data model as we move forward towards the development life cycle. And this would obviously impact your application layer.
MongoDB is schema less. You don't have to restrict yourself in a strict definition. The document's keys and values are not of fixed size and type. Addition and removal of keys also become easier with makes the development faster.
Easy Scaling:
We have already discussed how scale out provides better performance. MongoDB has been designed to scale out. The document-oriented data structure makes it easier to split one record across multiple servers. The database automatically takes care takes care of balancing the data and load across a cluster, redistributing documents automatically and routing user requests to the correct machines. So the developers can focus on programming the application, not scaling it. When a cluster need more capacity, new machines can be added and MongoDB will figure out how the existing data should be spread to them.
Indexing:
MongoDB is designed to support generic secondary indexes, allowing a variety of fast queries. This provides unique, compound and full text indexes. One of the unique feature of MongoDB is to support geospatial indexes.
Aggregation:
MongoDB supports a pipeline concept to build complex aggregation from simple pieces and allow the database to optimize it. This helps the user to implement complex logic, filter, sort, skip, limit in one query.
Special Collection:
In MongoDB a table (in RDBMS) is known as a Collection. MongoDB supports time-to-live collections for data that should expire at a certain time, such as sessions. Fixed-size collections, which are useful for holding recent data, such as logs are also supported.
Other than these unique features other common features like Replication, Backup & Recovery, Monitoring statistics, Security and User Administration are also supported here.
As we pointed out earlier two main features of a relational DB namely join and multi-document transaction is not supported in MongoDB. There are provisions and recommendations on how to address these "limitation"s. The schema design of MongoDB plays a major role in it and that will answer your question.
Before going to the schema design we will quickly touch upon some of the MongoDB nomenclature and practicals.
<< Prev Next >>
Liking it..
ReplyDelete