MongoDB vs Postgres

Hello, new to Strapi. Will using MongoDB be more scalable or performant than Postgres? Will there be a way to leverage geospatial queries with MongoDB?

Hi @elmundo

It largely depends on your use-case as to which database will be more performant, generally I would say PostgreSQL would be the better choice for single instance database nodes, if you are scaling the database then most like MariaDB + Galera cluster.

We don’t have native queries for geospatial on any database, but you can directly hook into the connectors (Mongoose and Bookshelf) to build your own spatial and geographic queries.

Since Strapi is heavily relational based, on SQL database you get the benefit of relational joins to increase performance.


Hi @elmundo, welcome to the forum.

Derrick already gave a clear answer, I just wanted to add that there is an old Stack Overflow question where in someone answered with an example with geospatial queries, maybe this could help you out a bit.

1 Like

Thanks very much! Is there any documentation on horizontally scaling the node app as well?

Thank you very much, we may just end up using geohashing so relational will be just fine. Cheers!

Not directly no but if you are using something like Nginx and the upstream proxy module it’s fairly easy.

If you take a look at some of our Nginx sample configs:

In those examples we are using the /etc/nginx/conf.d/upstream.conf with just a standard upstream block:

upstream strapi {

You could actually swap this out to something like:

upstream strapi {

In this case you can set as many “servers” at you want and even change out the least_conn to one of the other supported methods like round-robin, there is also some config stuff for keeping a client tied to a specific server (commonly called sticky or persistent connections). I would highly suggest you take a look through the Nginx proxy documentation and guides here: Using nginx as HTTP load balancer

Likewise other services such as Caddy, HAProxy, Traefik, and others can provide similar options. For horizontal + vertical scaling you can use a combination of one of these proxy applications and also something like PM2 Clusters.