Dr. Derek Austin 🥳
Sep 19 · 7 min read
Photo by Marlene Prusik on Unsplash

NoSQL is the name used to describe any type of database that does not correspond to the SQL relational model.

NoSQL databases originated in 2009 as sites like MySpace scaled up:

NoSQL came into existence because the databases at the time couldn’t handle the scale required.

MongoDB is the most famous of NoSQL databases. It is frequently used by JavaScript developers, especially those using MERN Stack or MEAN Stack (the combination of Mongo with Express, Angular or React, and Node).

Why People Are Leaving MongoDB

In general, NoSQL has significant differences from previous database architecture that can cause lost records and decreased performance:

NoSQL abandoned some of the core features of databases that make them highly performant and easy to use.

In response, many developers are considering moving away from MongoDB and NoSQL to alternatives such as JAM Stack, PostgreSQL, or DynamoDB.

The Guardian Famously Left MongoDB

The online publication and British newspaper The Guardian received over 100,000 views on its November 2018 article about leaving MongoDB:

In it, the developers who made the switch reveal that their team had problems with OpsManager — Mongo’s database management software — and that Mongo’s support agents were not much help during two outages.

I took a deep dive into the reasons the publication chose to move from MongoDB to PostgreSQL in Better Programming:

The Three Alternatives to MongoDB

While many people continue to use Mongo, there are many alternatives available for software developers and database engineers, such as:

  1. JAM Stack: Fast, secure, and dynamic web sites served without web servers.
  2. PostgreSQL: SQL database known for its reliability, features, and performance.
  3. DynamoDB: NoSQL database created by Amazon Web Services (AWS)

These three options are the current best alternatives to MongoDB. We’ll review the pros and cons of each choice in detail in the next section.

MongoDB Alternative #1: JAM Stack

JAM Stack is short for JavaScript, APIs, and prerendered Markup, and it is a type of serverless architecture that avoids needing a database at all.

JAM Stack could even replace a document database as long as the data could be moved to a whole lot of JSON files written in Markdown.

When using JAM Stack, the entire application is then compiled (or built), usually with a tool like Gatsby.

Unfortunately, that means that any change requires the site to be rebuilt.

On the other hand, dynamic content can change in real-time if it is accessed through an API, like comments handled through Disqus.

Advantages of JAM Stack

Lightning-fast content delivery is the biggest advantage of JAM Stack, because there is no server — the entire app is running client-side.

At the same time, there is also maximum SEO — because the app was pre-compiled, it is being served as static pages, not generated on-demand.

Another advantage to JAM Stack is minimal hosting costs. For example, static pages are basically free to host at AWS.

Disadvantages of JAM Stack

Every single change has to be re-built. That means the app needs to be recompiled before that change is going to be available live online.

And, the larger the website, the longer the build time. Every time.

Thus, JAM Stack is usually not seen as a good fit for apps requiring frequent publication, huge amounts of data, or live editing of data records.

MongoDB Alternative #2: PostgreSQL

Advocates of using SQL cite the ongoing prevalence of SQL architecture and superior ability to perform operation analytics on SQL databases:

[R]elational databases have evolved. They can can handle nearly all of the workloads, with the scalability, reliability, and availability requirements that modern applications demand.

In other words, if a SQL database can scale, then it is preferable to NoSQL.

PostgreSQL (also called Postgres) is a popular, free SQL database that calls itself “the world’s most advanced open source database” on its website.

Advantages of PostgreSQL

PostgreSQL is a powerful software that has been developed continuously for over 30 years. Lots of people use it and it has a vibrant community.

It is platform-independent. For those using AWS, it can be hosted using Amazon Aurora on the Amazon Relational Database Service (RDS).

Plus, PostgreSQL is blazing fast. Its performance is better than MySQL, and MySQL is already much faster than MongoDB.

Disadvantages of PostgreSQL

Using SQL inherently adds complexity to any project. It is an entirely new programming language for a team to use on a day-to-day basis.

It can be difficult to migrate from NoSQL to SQL. They are fundamentally a different type of database structure. NoSQL is a document store with key-value pairs, while SQL is composed of tables and rows.

One option, and what The Guardian used in their migration, is the JSONb column type in PostgreSQL. However, using JSON blobs feels kind of like a hack, like shoehorning a NoSQL database into a SQL format.

MongoDB Alternative #3: DynamoDB

DynamoDB is the NoSQL product from Amazon Web Services (AWS). Both MongoDB and DynamoDB store JSON-like data with arbitrary schema.

DynamoDB recently added a feature called encryption at rest, and now it is highly competitive with MongoDB while still being a NoSQL database.

That means migration from MongoDB to DynamoDB is really pretty easy.

Advantages of DynamoDB

DynamoDB is the flagship NoSQL database on AWS, so its inherent advantage is the AWS platform’s cost, speed, and reliability.

As an AWS product, it easily integrates with AWS Lambda and API Gateway.

The big advantage of DynamoDB for anyone currently using Mongo is that users can perform a live migration from MongoDB straight to DynamoDB.

The best part is there is no infrastructure to manage — Amazon handles it.

Disadvantages of DynamoDB

If I am of the opinion that NoSQL has too high of a probability of losing records, then DynamoDB is not going to be a good choice for me.

DynamoDB can have scalability problems, like those associated with so-called hotkeys, records that are assessed much more frequently than others.

In addition, compared to MongoDB, DynamoDB supports less complex data types and is an AWS-exclusive product.

My Opinion

“Containers won the battle, but will lose the war to serverless.”

JAM Stack is one of coolest technologies out today. It is absurdly fast, accessible, and SEO-friendly, plus static files are free to host on AWS.

However, JAM Stack is only the right option for apps that have the luxury of being able to have a build step and recompile every change.

If you ask me, I would argue that even very large websites could be built on a JAM Stack through scheduled compilations, say hourly. JAM Stack is rad.

It might not work for a news site, but many dynamic sites do not need content updated more frequently than that, and static sites surely do not.


If needing a compilation step is a deal-breaker for a project, then it comes down to SQL vs NoSQL: PostgreSQL or DynamoDB.

PostgreSQL does not have to be hosted on Amazon, though it can be hosted at Amazon RDS. DynamoDB was developed by and is exclusive to Amazon.

SQL databases are inherently more powerful but also more complicated. Their strength is in business analytics and search.

NoSQL databases are easier to set-up and sufficient for many projects. That’s why The Guardian considered DynamoDB for their 2.3m articles.

In the end, they chose PostgreSQL because DynamoDB did not offer encryption at rest back in 2017, but they may well have made a different decision if they were considering a move from MongoDB today.


JAM Stack (serverless architecture) is a wonderful option, especially for any site that is mostly static, and is also a great technology to be aware of.

PostgreSQL has a huge community and offers all the power of SQL in a reliable, feature-rich, open-source package with great performance.

DynamoDB is a drop-in replacement for MongoDB that gives you scale, security, and speed without needing to maintain any infrastructure.

Additional resources

  • The website PostgreSQL Tutorial teaches about what makes “PostgreSQL stand out from other database management systems”:
  • If you ask the people at Mongo, MongoDB is way better than DynamoDB:

Better Programming

Advice for programmers.

Dr. Derek Austin 🥳

Written by

😀 Full-Stack Web Developer 🤓 JavaScript 😄 React 😁 React Hooks 😆 Jest 🥰 CodeSandbox.io Contributor 🧠 Mobile App Developer 🤳 Doctor of Physical Therapy 🆒

Better Programming

Advice for programmers.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade