6 Things You Should Know Before Using MongoDB

6 Things You Should Know Before Using MongoDB

MongoDB is a very impressive document store database that can be used in most types of app development projects. It’s built using C++ language and is available for free as an open source edition. It was first worked upon in 2007 and since then it has become the most popular NoSQL database. So much so that it is now a part of dedicated technology stack- MEAN stack where M goes for MongoDB.

In previous months we have gone on and on about how overwhelming NoSQL databases are. We covered why NoSQL is better than SQL databases (taking into account specific use cases), which NoSQL databases are better for your app project and why it is great to combine different NoSQL databases to get better results. In addition to this information, one NoSQL database requires special mention is MongoDB which is what we are going to discuss here.
We here at Algoworks have used MongoDB for multiple mobile app development projects and in this post I will try to figure out whether MongoDB can be used instead of any other database like CouchDB, SimpleDB, or RIAK.

Why use MongoDB?

The main and the biggest benefit of MongoDB is that it is a no-fixed-schema database architecture. It is a NoSQL database so that’s kind of obvious. The next reason for choosing MongoDB is because of its document store nature which is very useful in multiple use cases. But we already got that covered in our ‘Choosing the Right NoSQL Database Type for App Development’ post. So the question comes why use MongoDB as your choice of Document Store Database. Here are a few reasons why:

Performance in Ad Hoc Queries
The biggest advantage of MongoDB over other databases is its performance under pressure especially when handling ad hoc queries on data that are usually updated in real time. MongoDB can retrieve specific fields, ranges, locations, values, and even respond well to regular expression queries. MongoDB uses SQLesc kind of query language so it is easy to learn and its capability in handling dynamic queries sets it apart from CouchDB which requires setting up views first.

In an experiment that we carried out on MongoDB performance for one of our projects we found that MongoDB can handle up to 4 queries per millisecond easily. For this experiment we used a Linode server with following configurations

  • 4 core 2.80GHz each
  • 4096 MB RAM

We found that at frequencies of 2 queries per millisecond, MongoDB was performing great with an average output time of 5ms. However at the frequency of 4 queries/ms, the output time started to increase and the average output time increased. For some queries the output time was even as high as 1200ms.

MongoDB is most suited for applications which require consistent data presentation for users. Therefore if your main aim is availability of database for just data entry during data visualization, consistency is not an issue (like for example in a social network), then you can go with CouchDB or some other counterpart. However before doing that take performance into consideration as well.

Location Based Query Feature
MongoDB is the best choice if you are going to build an app that has location based features like location finding, location based event tracking etc. MongoDB is the only free document storage NoSQL database with inbuilt geo-spatial features.

The database can be scaled horizontally very easily. The database scalability is handled via innovative Sharding which is pretty unique in its own. We especially liked MongoDB’s performance in replicating the data and creating replica set to increase availability and consistency. The database is smart enough to handle replica operation failures while still coming out with consistent values.

Load balancing on Multiple Servers
Most document storage databases are equipped with features to allow scalability over multiple servers. Unlike SQL databases, multiple server based databases can be easily clustered in NoSQL. MongoDB is no exception but we found its performance on multiple server based apps better in comparison with CouchDB but again our use case was biased towards MongoDB in that experiment.

JSON based document storage schema
MongoDB uses JSON (JavaScript Object Notation) based document storage schema called BSON. The main benefit of this format comes in use-cases where you would have to integrate your app with other platforms. For example YouTube API outputs its data in JSON format so MongoDB is great in handling those request.


MongoDB is magnificent. It’s great for projects that require schema-less storage of data and has the capability to handle huge databases. The database is best suited for creating CMS platforms, blogging platforms, data analytics platforms, e-commerce portals, document storage portals, Metadata storage, and location based applications.

But that’s not all.

In my next blog we shall be talking about Algoworks’ experience with MongoDB and have some more insights into the MongoDB database.

References: Nahurst Blog, Scottlogic Blog, Sarahmei Blog, MongoDB Docs

The following two tabs change content below.
Rachit Agarwal

Rachit Agarwal

Director and Co-Founder at Algoworks Technologies
Rachit is leading the mobility business development function, mobility strategy and consulting practice at Algoworks. He is an expert of all mobile technologies and has experience in managing teams involved in the development of custom iPhone/iPad/Android apps.
Rachit Agarwal

Latest posts by Rachit Agarwal (see all)

Rachit Agarwal6 Things You Should Know Before Using MongoDB