As the size and reach of web applications grow on a daily basis, there arises a need to create scalable web applications that can be easily scaled up or down to meet the needs to the customers/users.
A very essential part of this scalability is the judicious use of databases. Databases are the backbone of a web application because this is the place where all the data is stored and it matters a lot when we are thinking about scaling an application. Proper and wise use of database resources creates a better platform for the web designers or front end engineers to show the information to the users in a very short time, even for a big application, covering millions and millions of users – something like Facebook, Flipkart, Amazon etc.
With time, we realized that having a relational database management system comes with quirks of its own when scaling an application. There is a very good article on Medium about this.
So came the notion of NoSQL, a family of non relational databases, where the conventional definitions of tables, rows, relations etc. where not that much important than the RDBMS. In summer of 2007, Eliot Horowitz and Dwight Merriman invented what we today call as MONGODB. MongoDB was accepted with open hands from the dev community and today it has grown to be a hugely popular open source technology, managed by a software company of the same name.
WHAT IS MongoDB
Mongo DB is a powerful, flexible and scalable general-purpose database, based on the concept of Non Relational Database Management Systems. It combines the ability to scale out with features such as secondary indexes, range queries, sorting, aggregations, and geospatial indexes.
MongoDB is a document-oriented database, not a relational one. A document-oriented database replaces the concept of a “row” with a more flexible model, the “document”., which allows embedded documents and arrays, which makes it possible to represent complex hierarchical relationships within a single record.
So, there are a lot of reasons for choosing MongoDB- ease of scalability being the primary one.
- Easy Scaling – We applications and their data sets are growing at an enormous rates. For ex. a TB of data, was largely unheard of, or at least very less heard of in the last decade. However, with the growth of web, a TB of data now holds little significance to devs. As this happens devs struggle to store and fetch this data from RDMS at a pace which is acceptable to the users. Also problems of scaling – either scaling up (getting a bigger machine) or scaling out ( partition data across more machines) arises.
In these situations, MongoDB helps out. It was designed to scale out. The document oriented structure makes it easier for the data to be split between multiple servers. The task of balancing data and load across a cluster is automatically balanced by Mongo. Hence devs. can focus on creating applications rather than scaling them.
- Features – Mongo provides a bucket load of features like Indexing, Aggregation Special Collection types, File Storage, Secondary Indexes, Range Query etc.
- Speed – Mongo does all the work without sacrificing speed. Performance is a major goal for MongoDB and has shaped much of it’s design. We’ll read about these features as we go through MongoDB.
For now on, let’s get started with the basics of MongoDB.