Why and When to Use MongoDB

Why Use MongoDB?

MongoDB is a document database built on a scale-out architecture that has become popular with developers of all kinds who are building scalable applications using agile methodologies.

MongoDB was built for people who are building internet and business applications who need to evolve quickly and scale elegantly. If you are doing that, you should consider MongoDB.

Companies and development teams of all sizes use MongoDB because:

  • The document data model is a powerful way to store and retrieve data that allows developers to move fast.
  • MongoDB’s horizontal, scale-out architecture can support huge volumes of both data and traffic.

  • MongoDB has a great user experience for developers who can install MongoDB and start writing code immediately.

  • MongoDB can be used everywhere by anyone:

    • For free through the open source community edition
    • In the largest data centers through the enterprise edition
    • In any of the major public clouds through MongoDB Atlas

  • MongoDB has developed a large and mature platform ecosystem, which means:

    • MongoDB has a worldwide community of developers and consultants, so it is easy to get help.
    • MongoDB works on all types of computing platforms, both on-premise and in the cloud (both private, and public clouds such as AWS, Azure, and Google Cloud)
    • MongoDB can be used from all major languages.
    • MongoDB can be accessed from all major ETL and data management systems.
    • MongoDB has enterprise-grade support.

Why use MongoDB? Simply to go further and faster when developing software applications that have to handle data of all sorts in a scalable way.

Thousands of companies like Bosch, Barclays, and Morgan Stanley run their businesses on MongoDB, and use it to handle their most demanding apps in areas like IoT, Gaming, Logistics, Banking, e-Commerce, and Content Management.

MongoDB is a great choice if you need to:

  • Represent data with natural clusters and variability over time or in its structure
  • Support rapid iterative development.
  • Enable collaboration of a large number of teams
  • Scale to high levels of read and write traffic.
  • Scale your data repository to a massive size.
  • Evolve the type of deployment as the business changes.
  • Store, manage, and search data with text, geospatial, or time series dimensions.

MongoDB as a company has grown because the number of use cases with these characteristics keep growing.

What Is MongoDB?

MongoDB is an open-source document database built on a horizontal scale-out architecture. Founded in 2007, MongoDB has a worldwide following in the developer community.

Instead of storing data in tables of rows or columns like SQL databases, each row in a MongoDB database is a document described in JSON, a formatting language.

Here’s a simple JSON document describing contact information:

  "name" :  "Carlos Smith",
  "title" : "Product Manager",
  "location" : "New York, NY",
  "twitter" : "@MongoDB",
  "facebook" : "@MongoDB"

Document databases are extremely flexible, allowing variations in the structure of documents and allowing storage of documents that are partially complete. One document can have others embedded in it.

Fields in a document play the role of columns in a SQL database, and like columns, they can be indexed to increase search performance.

Best of all for many developers, the programmer can change the structure of the database easily as needs change. Some say this turns data into code.

From its founding, MongoDB was built on a scale-out architecture, a structure that allows many small machines to work together to create systems that are fast and handle huge amounts of data.

MongoDB has always focused on providing developers an excellent user experience, which, in addition to all its other properties, has made MongoDB a favorite of developers worldwide for a huge variety of applications.

How and When Did MongoDB Get Started?

The name Mongo is a slice of the word humongous.

The database has its roots in the frustrations of Dwight Merriman, Eliot Horowitz, and Kevin Ryan, who co-founded MongoDB in NYC in 2007 after they struggled to build web-scale applications for DoubleClick, one of the pioneers of digital advertising technology that eventually became a part of Google.

The founders wanted to build a database that developers would love, a database that would break through the barriers in Relational Database Management Systems (RDBMS) that use the SQL query language.

Why do Developers Love MongoDB?

A multitude of new databases is created every year. MongoDB has become one of the most popular in the world because developers really like using it to store, manage, and retrieve data when creating applications.

To understand whether MongoDB is right for you, let’s look at why developers like MongoDB so much.

The Power of Document-oriented Databases

MongoDB is the pioneer of what has come to be called NoSQL databases, which developed because RDBMS systems based on SQL did not support the scale or rapid development cycles needed for creating modern applications.

NoSQL is an umbrella term; it includes document-oriented databases like MongoDB, columnar databases, in-memory databases, and more.

The “documents” in MongoDB are JSON and BSON files.

JSON is powerful for many reasons:

  • It is a natural form to store data.

  • It is human readable.

  • Structured and unstructured information can be stored in the same document.

  • You can nest JSON to store complex data objects.

  • JSON has a flexible and dynamic schema, so adding fields or leaving a field out is no problem.

Perhaps most importantly, the structure of the information is under the control of the developer. Developers adjust and reformat the database as the application evolves without the help of a database administrator. When needed, MongoDB can coordinate and control changes to the structure of documents using schema validation.

MongoDB created Binary JSON format (BSON) to increase efficiency and support more data types. Data stored in BSON can be searched and indexed, tremendously increasing performance. MongoDB supports a wide variety of indexing methods including text, decimal, geospatial, and partial.

Geospatial tagging was added so that documents can be queried by location.

Developer User Experience

MongoDB has always devoted abundant time and energy to making sure developers have a great experience.

Developers have always loved JSON because it is a simple and powerful way to describe and store data. Not only can you store data that looks like rows and columns, but you can embed documents inside each other, a technique that allows complex data objects to be stored and retrieved together. Once you know how to describe data in JSON, the database is much less of a problem.

MongoDB is easy to install and use. One metric MongoDB sought to minimize is the time it takes to start writing code after downloading MongoDB. (The MongoDB team used a stopwatch to measure that.)

Developers like the fact that MongoDB has made sure the database can be used from a wide variety of programming languages, including: C, C# and .NET, C++, Erlang, Haskell, Java, JavaScript, Perl, PHP, Python, Ruby, and Scala (via Casbah).

As more and more business users have joined the MongoDB community, features have been added to support use and operation of MongoDB in enterprise IT departments, including first-class support.

MongoDB Atlas is the core database at the center of the MongoDB Cloud. MongoDB Atlas allows developers to get started right away in any of the public clouds and easily migrate on-premise MongoDB instances to the cloud.

MongoDB Atlas also embeds powerful capabilities like:

Scalability and Transactionality

MongoDB’s scale-out architecture, which distributes work across many smaller (and cheaper) computers, means that you can create an application confident that it will handle spikes in traffic as your business grows.

MongoDB engineering innovations support massive numbers of reads and writes. At the heart of these innovations is MongoDB’s approach to sharding, which allows clusters of information to be stored together as the information is spread across the cluster of computers.

By comparison, most SQL databases use a scale-up architecture that is limited because it relies on creating faster and more powerful computers.

MongoDB also supports database transactions that allow many changes to a database to be grouped together and either made or rejected in a batch. This is one of the most important features for support of advanced applications.

Platform and Ecosystem Maturity

MongoDB has been around for more than 13 years and has been deployed at thousands of companies for a wide range of use cases. A natural result of that level of usage is that the platform has been extended to meet a massive number of new demands.

Most large organizations want to make sure it is easy to get help using any technology that becomes the foundation of their business.

MongoDB has a large and thriving community of developers across the open source community, academia, and among system integrators and consulting firms across the globe.

What is MongoDB Used For and When Should I Use It?

As explained already MongoDB is used in a wide variety of ways to support applications in IoT, Gaming, Logistics, Banking, e-Commerce, and Content Management.

MongoDB has found a home in so many different businesses and functions because it does a great job solving many longstanding problems in data management and software development.

Here are a few of the problems that MongoDB solves:

  • Integrating large amounts of diverse data: If you are bringing together tens or hundreds of data sources, the flexibility and power of the document model can create a unified single view in ways that other databases cannot. MongoDB has succeeded in bringing such projects to life when approaches using other databases failed.

  • Describing complex data structures that evolve: Document databases allow embedding of documents to describe nested structures and easily tolerate variations in data in generations of documents. Specialized data formats like geospatial are efficiently supported. This results in a repository that is resilient and doesn’t break or need to be redesigned every time something changes.

  • Delivering data in high-performance applications: MongoDB’s scale-out architecture can support huge numbers of transactions on humongous databases. Unlike other databases that either cannot support such scale or can only do so with massive amounts of engineering and additional components, MongoDB has a clear path to scalability because of the way it was designed. MongoDB is scalable out of the box.

  • Supporting hybrid and multi-cloud applications: MongoDB can be deployed and run on a desktop, a huge cluster of computers in a data center, or in a public cloud, either as installed software or through MongoDB Atlas, a database as a service product. If you have applications that need to run wherever they make sense, MongoDB supports any configuration now and in the future.

  • Supporting agile development and collaboration: Document databases put developers in charge of the data. Data becomes like code that is friendly to developers. This is far different from making developers use a strange system that requires a specialist. Document databases also allow evolution of the structure of the data as needs are better understood. Collaboration and governance can take place by allowing one team to control one part of a document and another team to control another part.


What's the fastest way to get started using MongoDB?

MongoDB Atlas is a fully-managed database as a service that runs on all public clouds. It scales from a free tier (no credit card required) to global clusters.

Can I use MongoDB locally?

Both MongoDB Enterprise Server and MongoDB Community Server can be locally installed and used in a self-managed manner.

You can run either of these editions on your own hardware or in the cloud.

How do I manage and configure MongoDB?

The most powerful and complete way to manage and configure MongoDB is through the command line interface (CLI). All of the functionality of MongoDB is available through the CLI which uses the mongo shell to enter commands and receive output.

To use the mongo shell, you must have a user set up on a MongoDB cluster. Then you install the mongo shell on your computer and connect to the user account on the cluster.

Then you are off and running and can enter commands to configure the cluster or create databases or get information about how the cluster is running.

In June of 2020, MongoDB released some improvements to the shell.

MongoDB Compass offers a GUI for those who prefer a visual interface. MongoDB Compass offers a way to visualize your data, create indexes, and assemble complex aggregation pipelines that streamline the way you work with data.

Ready to get started?

Try MongoDB on the Cloud for Free with MongoDB Atlas!