Curious how to determine if MongoDB is right for your application? In this post, I’ll describe two different application scenarios and show how MongoDB could be utilized in each. After discussing the scenarios, we’ll wrap it up by pointing out the advantages and disadvantages of MongoDB for each workload.
Accelerate your career in cloud
A Cloud Guru makes it easy (and awesome) to level up your cloud career — even if you’re totally new to tech. Check out ACG’s current free courses or get started now with a free trial.
What is MongoDB?
MongoDB is an open-source document database that has many enterprise class features that make it suitable for a variety of (but not all) applications. Understanding these features — and knowing how they affect different workloads can help you determine if MongoDB is right for your application.
Let’s explore a couple of scenarios to talk about how MongoDB might be used in each.
A variety of cloud platforms are used to deploy the application. The team wants to utilize globally distributed nodes to ensure their data is highly available to their world-wide customer base.
The structure of the data tends to change frequently to meet customer needs. To support this, the chosen data store will need the flexibility to easily change the data schema.
Sam works for a local manufacturing company building an application to manage their quality assurance and testing procedures. The company has only one location and has not deployed applications to the cloud before. They’re most comfortable with traditional on site deployments.
The application Sam works on must interface with the older manufacturing equipment, so upgrading to the latest versions can be difficult.
The structure of the data set Sam is working with does not change much, and it’s highly normalized with many relationships between tables.
Get the Cloud Dictionary of Pain
Speaking cloud doesn’t have to be hard. We analyzed millions of responses to ID the top concepts that trip people up. Grab this cloud guide for succinct definitions of some of the most painful cloud terms.
How could MongoDB be used?
The two scenarios described above are very different and exemplify different aspects of typical application usage patterns. Let’s look at how MongoDB could be utilized in these use cases.
On the other hand Sam’s application in scenario two must utilize older technology to remain compatible with the manufacturing equipment. This can make interfacing with MongoDB more difficult. Many official drivers are available, but you may need to search the community supported drivers to find obscure ones.
The rapidly changing schema and need for globally distributed nodes make Lisa’s application a good fit for MongoDB. By utilizing the flexible schema of json documents and globally distributed replica sets or shards, MongoDB can meet both of these needs for Lisa’s application.
Sam’s application with its static data schema and single location does not require these enterprise features of MongoDB. The highly relational nature of Sam’s data set also makes it more difficult to implement. By utilizing embedded documents, relations can be represented while maintaining atomic operations. While multi-document transactions are possible in MongoDB, these can incur a performance penalty and are best to be avoided.
Learn more about MongoDB
While flexible and able to meet most application needs, there is a sweet spot of MongoDB use cases. Understanding your application needs and knowing the available MongoDB features can help ensure you make the best choice.
Ready to learn more about MongoDB? Check out our new course MongoDB Deep Dive and gain a better understanding of the features available in MongoDB and how to utilize them in your applications. We’ll explore replication and sharding, as well as monitoring and backups. We’ll also look at MongoDB support on a variety of cloud vendors and connecting via the mongosh shell. We’ll be manipulating files on the command line, so some basic Linux knowledge is expected. Familiarity with document databases is useful but not mandatory.
Looking for to learn more about cloud and the hottest skills in tech? Start a free trial or check out this month’s free cloud training. You can also subscribe to A Cloud Guru on YouTube for weekly cloud news, like us on Facebook, follow us on Twitter, and join the conversation on Discord.