Data / Development / Storage / Sponsored / Contributed

Empower Modern App Developers with Document Databases

3 Nov 2021 10:30am, by

Andrew Davidson
Andrew is vice president of cloud products at MongoDB. He previously worked on scaling global mapping operations at Google, has a background in physics and has lived extensively in South Asia.

Across industries, business success depends on a company’s ability to deliver new digital experiences through software. The speed at which a company can develop and deploy a new application with innovative features is a direct lever on business outcomes. Given the vital role developers play in the success of your business, it stands to reason that equipping them with the tools to maximize their productivity is in your best interest.

Unfortunately, many organizations are unaware of the tax they’re placing on their development teams by using a relational database. While the relational database has been a bedrock for data-driven applications for 50 years, it was developed in an era before the internet and is a poor fit as the foundation of today’s web and mobile applications.

Document databases, which have emerged over the past decade, have cemented themselves as the most popular and widely used alternative to the tabular model found in traditional relational databases. Document databases have become so powerful that even relational databases are trying to emulate them. Built around JavaScript Object Notation (JSON)–like documents, document databases are intuitive for developers to use. Instead of the rigid row-and-column structure of the relational model, document databases map documents directly to objects in code, which is how coders naturally think of and work with data.

Let’s break down the key advantages to document databases in building modern applications. We’ll see why the document model’s flexibility eliminates the complex intergroup dependencies that have traditionally slowed developers down.

The Limitations of the Relational Database Model

Relational databases add complexity to a developer’s workload, severely hampering the velocity of work. The rigid row-and-column structure creates a mismatch between the way developers think of code and data, and how they need to store it. Additionally, while the relational model was fine in an age when most applications used a small pre-set of attributes such as last names, ZIP codes, and state abbreviations, the majority of data collected by organizations today is rich in structure. We have given names and sometimes preferred names. We have unique attributes that are relevant to only some of us: For example, people with PhDs have dissertation topics, sports lovers have favorite sports, our families come in every conceivable shape and size. This richly structured data reflects how we actually think about the real world, and it’s very difficult to flatten, store, analyze or query using rows and columns.

With relational databases, developers can feel stuck in quicksand with changes to their their applications requiring them to carefully collaborate with experts like database administrators (DBAs) who help them translate their schemas and queries to underlying relational data models to ensure that indexing strategies are appropriately employed. The layer of indirection increases cognitive load, is hard to reason about and slows everything down. More than half of application changes require database schema modifications. Those database modifications take longer to complete than the application changes they are designed to support. You can quickly see why these complicated efforts severely slow delivery of new software features into production.

Enabling Development of Modern Apps with Document Databases

With the birth of the internet and the proliferation of mobile and web apps, developers’ roles evolved. The emergence of robust development frameworks, which abstracted away underlying complexity, and the rise of DevOps led organizations to consolidate developer functions. The new generation of full-stack developers wanted databases that better addressed their applications’ requirements and their ways of working with data.

The founders of MongoDB recognized a need for a modern database solution while at the adtech giant DoubleClick in 2007. They still were unable to scale to the 400,000 transactions per second the business required due to the constraints of the relational model. These challenges inspired them to create a new, modern, general-purpose database. This database could address the shortcomings of the relational data model and offer a solution that developers actually wanted to use. The result was a horizontally scalable, document-based NoSQL database called MongoDB. The document database model in general, and MongoDB more specifically, addresses the limitations of relational databases in several notable ways:

Intuitive data model: The documents at the center of document databases have a universal data format. JSON is a lightweight, language-independent and human-readable format that has become a widely used standard for storing and exchanging data. These documents map directly to data structures in popular programming languages so there is no need for the additional mapping layer often used with relational databases. Because data that is accessed together is stored together, there is less code to write; developers don’t need to decompose data across tables or run joins.

Flexible schema: These JSON-like documents are flexible. Each document can have its own fields, and there’s no need to pre-define the schema in the database. It can be modified at any time. That flexibility enhances developer agility. As the developers at Travelers Insurance found, moving from a relational database to MongoDB enabled the company to significantly accelerate the delivery of new software applications.

Meeting User Expectations While Simplifying Application Architectures

The most innovative applications we use in our daily lives — think Netflix, Instagram, Twitter — have raised user expectations for what every application should be. Today we expect applications to be:

  • Highly responsive
  • Able to deliver relevant information
  • Optimized for mobile devices
  • Secure
  • Powered by real-time insights
  • Continuously improved

Meeting those expectations can be extremely challenging, especially for developers using relational databases. A typical data infrastructure built around a legacy relational database can trap your development team in overly complex and siloed architectures. Document databases, on the other hand, can simplify application architectures. Documents are a superset of all other data models, so developers can store and work with a variety of data types. Development teams can accommodate most of their use cases in a single data model and database.

The move to a document database enabled Toyota Material Handling Europe to transition from a monolithic code base to a microservices-based architecture as their development teams were supporting a historic industry shift to smarter, more autonomous and safer factories.

“The most beautiful part is the data model. Everything is a natural JSON document,” said Filip Dadgar, formerly principal solutions architect and IT manager, Toyota Material Handling Europe. “So for the developers, it is easy, really easy for them to work with quickly. [They are] spending time on building business value rather than data modeling.”

You might not be managing a fleet of 100,000 warehouse trucks outfitted with IoT sensors like Toyota. Yet, the document data model can still help your developers overcome the limitations of the relational model while improving their productivity and velocity. They can minimize the undifferentiated work of maintaining their infrastructure and focus on meeting demanding user expectations. As a result, they can deliver better, more innovative applications faster than before.

Interested in data modeling in JSON, but don’t know where to start? Check out our white paper or attend our weekly webinar series.

Featured image via Pixabay