DEV Community

Elitech Systems
Elitech Systems

Posted on

Why Use MongoDB?

MongoDB is a database system. It has become extremely popular over the past few years.

In this article, we'll take a look at what MongoDB is, when to use it, and when to avoid it.

What is MongoDB?

MongoDB is an object-oriented, dynamic, stable, scalable, SQL-free database system. The objects are stored in JSON format in separate documents. Instead of storing the data as tables with values, we use a hierarchy and a JSON object system to create a more adaptive system.

The advantage of MongoDB is to implement a high-performance system with perfect scalability. The system is extremely easy to install, it works under all operating systems and there are libraries to handle it in all languages.

MongoDB vs SQL

The vast majority of databases run on SQL. Be it SQLite, Postgres or even Mysql, the base language is common. MongoDB belongs to the family of NoSQL languages. The code and functionality are therefore fundamentally different.

Where SQL will use a system of tables and complex relations, MongoDB works quite simply. We create a document with tree data. It is then possible to link these documents with links by _id

MongoDB's big advantage over SQL is its ability to handle complex data systems. We can have lists, encapsulated objects without having to worry.

This operation greatly facilitates the development of applications that handle a lot of data. With a little practice, it is possible to create extremely well-organized document templates, which saves time.

The advantages of MongoDB

No system is perfect, so let's take a look at the advantages of MongoDB to help you make a choice:

  • Document orientation
  • Excellent performance
  • Simple to replicate
  • Very good scalability
  • A totally dynamic system
  • Very good flexibility
  • Heterogeneous data
  • A management system in JSON and BSON (binary JSON)
  • A search and modification system as good as SQL

Excellent performance compared to the cloud. AWS, Google Cloud and Azure offer solutions to implement MongoDB very easily.

The disadvantages of MongoDB

MongoDB has a few drawbacks. It is important to take them into account when making your decision:

  • Does not work with a table system, so you need to learn how to create document schemas
  • Complex transactions
  • No direct system to create links between documents

In which situation to choose MongoDB

Here is a list of the types of applications that work very well with MongoDB:

  • An e-commerce site
  • Blogs and content management
  • Real-time management applications
  • Social networks

In conclusion

MongoDB is a very powerful database system. It doesn't work with SQL, so you'll have to learn a new language. The data is stored as JSON documents, so it is possible to create complex trees.

Top comments (1)

Collapse
 
gmcamposano profile image
gmcamposano

Very true. It is a very good DB when you don't have a well structured schema. It has worked for me as a startup because I keep adding new functionalities that makes my schemas grow and change.