Member-only story

Choosing a node.js database

Forbes Lindesay
3 min readFeb 7, 2021

--

Originally posted on atdatabases.org

One of the first things you’ll need to do when starting most node projects is to chose a database and database library. You’ll normally want to choose your database before you choose the library, but in the case of @databases, we support a few different databases, so you do have some leeway.

SQL vs. NoSQL

In recent years, NoSQL databases have grown, and then somewhat declined in popularity. They often seem much easier to get started with than SQL databases because you don’t need to learn any new language, and you don’t need to define your schema up-front. They also promised (in theory) some improvements in scalability vs. more traditional SQL databases.

While there are some situations where the scalability part is relevant, you should keep in mind that Facebook stores the vast majority of its data in a few MySQL servers. Unless you are a very big tech company like Google or Facebook, it is likely that Postgres or MySQL will scale to meet your needs with no problems.

The idea that you can get away without thinking as carefully about your schema in NoSQL databases is also often flawed. You normally end up with just as rigid a schema definition, except nobody has written down what that schema is.

The point about learning SQL is valid, but you can get started without needing to learn very much, and it is an extremely useful skill to develop. If you must use a NoSQL database, MongoDB remains one…

--

--

Forbes Lindesay
Forbes Lindesay

Written by Forbes Lindesay

JavaScript enthusiast and maintainer of many open source projects.

No responses yet