MongoDB - How it is advantageous, and why are we using it?

Before we begin with the MongoDB installation, let's understand why we have chosen the MongoDB database and what it is needed for.

Let's take a look at the advantages of MongoDB over RDBMS:

  • Flexible schema: MongoDB is a document database in which one collection holds multiple documents. We don't need to define the schema of the documents prior to inserting the data, which means MongoDB defines the document's schema based on the data inserted into the documents; whereas, in an RDBMS, we need to define the schema of the tables before inserting data into it.
  • Less complexity: There are no complex joins in MongoDB, as we have in the case of RDBMS (for example: MySQL) databases.
  • Easier scalability: It is very easy to scale out MongoDB as compared to an RDBMS.
  • Fast accessibility: There is faster retrieval of data in MongoDB as compared to an RDBMS, that is, the MySQL database.
  • Dynamic querying: MongoDB supports dynamic queries on documents, being a document-based query language, which makes it advantageous over other RDBMS, which could be MySQL.

The following are the reasons why we should use MongoDB:

  • MongoDB stores data in JSON-style documents, which makes it easy to integrate with the application
  • We can set an index on any file and property
  • MongoDB does auto-sharding, which makes it easy to manage and enables it to be faster
  • MongoDB provides replication and high availability when used in a cluster

There are different use cases in which to use MongoDB. Let's check them here:

  • Big data
  • User data management
  • Content delivery and management

The following image shows the architecture diagram of MongoDB integration with your web application:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.64.172