Why to opt for MongoDB as your NoSql replacement to traditional RDBMS?


What is MongoDB?

MongoDB is an open source, JSON-based, document database and leading NoSql database written in C++ to deploy highly performance oriented and scalable database. It uses custom binary (BSON) protocol.

MongoDB has a simple but powerful javascript shell, which helps in administration of MongoDB instances and data manipulation. Its current stable version is 2.6.7 released in January, 2015 with aggregation enhancements, security improvements, query-engine improvements etc.

For installation steps, refer this link – http://docs.mongodb.org/manual/installation/

Why to opt for MongoDB as your NoSQL Replacement to traditional RDBMS

What is MongoDB good for?

“Show me your code and conceal your data structures, and I shall continue to be mystified.
Show me your data structures, and I won’t usually need your code; it’ll be obvious.”

– Eric Raymond, the Cathedral and the Bazaar

True are these words that say data structure is of paramount importance. with MongoDB, we can model the data structure more easily and expressively. Let’s list some main features of MongoDB –

  • MongoDB is known for its strong data consistency.
  • It retains some friendly features of SQL i.e. Queries, Indexes.
  • It can handle multiple dynamic queries with bigger databases.
  • Master/slave replication (auto failover with replica sets).
  • Built-in sharding.
  • The flexible schema of MongoDB is great for heterogeneous collections of content types.
  • MongoDB is capable of keeping data with complex relationships together in one object.
  • It is easily configurable unlike other NoSql databases.
  • Storing any type of structured log data is the future.
  • Its key/value data representation makes it easy to use.
  • MongoDB can store location based data. It understands geo-spatial coordinates and natively supports geo-spatial indexing.

Some insights into MongoDB

A document is the key element in MongoDB. A document can be considered as a row in a table in traditional RDBMS. It is represented in key/value pairs i.e. an ordered set of keys with associative values. In JavaScript, for example, documents are represented as objects:

{“blog” : “mongodb!”}

Here, this simple document has single key “blog”with value “mongodb!”
A collection can be thought of as a table with a dynamic schema. A single instance of MongoDB can host multiple independent databases, each of which can have its own collections. Every document has a special key, “_id”, which is unique within a collection.
Data Manipulation
To insert data into MongoDB collection, you need to use insert() method –


_id: ObjectId(8hju8ad8jb25),
title: ‘MongoDB Blog,
description: ‘Leading NoSql Database’,
version : 2.6,
format : json

To fetch data from MongoDB collection, use find() method –


To update data, use update() method –

>db.collection.update(criteria, new_data)

>db.mycol.update({‘title’:’MongoDB Blog’},{$set:{‘title’:’Mongo Lab’}},{multi:true})

To delete data, use remove() method as follows –


For more data manipulation commands, refer to this link – http://docs.mongodb.org/manual/reference/command/


Enterprises adopting MongoDB

MongoDB has been adopted by numerous major websites and services, including Craigslist, eBay, Foursquare, SourceForge, Viacom, and the New York Times, among others as their backend.

MongoDB v/s SQL Databases

  • Sql databases store structured data in fixed data types whereas; MongoDB can store data dynamically and dissimilar data can be stored together as required.
  • Sql databases store data in rows in tables, MongoDB uses key/value pairs to store data in collections comprises of various documents.
  • With MongoDB, A database administrator can simply add capacity by using various servers or cloud instances whereas; same process requires significant additional engineering for Sql databases.

If there are concurrent dynamic queries in your web application on enormous amount of data and you preferably define indexes over map/reduce functions, MongoDB is a good database to go for.

Never Miss Another Update
Subscribe to receive the latest updates

I have read and accept the Privacy Policy

We'd love to hear from you

I have read and accept the Privacy Policy
× Talk to us on WhatsApp!