Node.js/Express - MongoDB vs. MySQL (or other RDB's)

Hello, campers!

I’ve learned Node.js, Express, and MongoDB on an edX/Microsoft course and I’m enjoying it (the Node.js and Express part), and I even made a simple (the cliche) TODO app with a RESTfull API and CRUD operations.

The thing is… I’m in UNI, and just learned the Relational DB MySQL and the SQL language.
At first, I liked the MongoDB JSON like documents, but I came to the conclusion that I prefer relational databases.

It REALLY grinds my gears not being able to do normalization and to not have relations.

It’s actually starting to be painful working with Mongo and not MySQL (or any other RDB).
I don’t enjoy it at all.

My question is:
I know it is possible to use MySQL with Node.js/Express, but would it be any problem?

For doing the FCC projects in the future for example (I’m currently waiting for the beta before starting the backend challenges), or for finding work.

Is there a problem if I use MySQL with Node.js/Express instead of MongoDB?
(for FCC projects and for finding work)

I have tried using MySQL. The only problem I had was connecting to an externally hosted Db.

This problem I have not investigated thoroughly so if you figure it out I would be interested. :pray:

Working locally (db & website on same server) it was easy enough.
There is also a plugin for node to connect to MS SQL. (and probably for PostgreSQL)
I read PostgreSQL is still very popular (more than MongoDb).

So the only issue I can see is how you would have the MySQL Db hosted on the internet when deploying the final project (the issue I describe above).

PS. For MongoDb I use which is free on sandbox mode.

1 Like

Having done a few projects with Mongo, I’m planning to look at Postgres next (I’ve also read that it’s very popular) and I’m hoping to be able to do so using Heroku - Haven’t tried it yet. Looks like it is (initially) free and there are plenty of docs here:


If you can explain why you chose MySql over Mongo, there isn’t a problem, ie you looked at the project requirements, weighed the pros and cons of the databases, and picked the best database for the project. That would be the most impressive answer. Otherwise, an explanation of “I wanted to apply what I learned in my sql course to my projects” is acceptable for a junior developer.

1 Like

Mongo is good for prototype-ey stuff like the FCC projects because the API is just JS, you don’t need to learn a different language, there are easy to use hosted solutions with free tiers that work great, it’s really simple to build simple things using it, you don’t need to think about structures beforehand (you just chuck stuff in JSON blobs), etc, etc.

But, but, relational DBs are far more generally useful than Mongo, which is pretty specialised/limited when it comes to real-world applications. If you think the data fits a relational structure (which all the FCC projects do), then a relational DB is going to be a better fit: I’m biased (I think Mongo is junk), but I think you’re right to be distrustful. It’ll be a little more work to set up, but there’s no reason why you can’t use an RDB. Re jobs, SQL is always useful, nearly everyone uses RDBs in some part of their stack, generally as the core data store.

Also biased view, but re RDBs, learn PosgreSQL, it’s an amazing piece of technology.


I wrote an API in PHP to be able to access MySQL databases. I figured this would be a lot easier than trying to figure out how to get React to talk to MySQL :wink:


On the course I just did (on Pluralsight) he got the data via axios API call from a WordPress API. Pretty cool solution.

Thank you for your answer and info.
I haven’t done any hosted app yet, only local, but I will be researching on that in the future, and if I find any good solution I’ll contact you :slight_smile:

I see you think relational like me! :wink:
I love to create the architecture of a database and doing all the normalization and denormalization…
Of course some apps don’t need to have a relational architecture, but still, as you said, I also think that RDB are far superior.

I learned MySQL because it was uni content (I will have my exam this Thursday), but I’ve been actually looking at PostgreSQL for some time now.
I just don’t know if it’s a big learning curve (for example, if the SQL syntax change, or the set up process, or the way of doing things), and also the performance. I read somewhere that in terms of query performance it’s a little bit slower than MySQL.

I need to research more into PostgreSQL.

Thanks for the answer and the great info!

Yeah, it is more complex vs. MySQL, so there is that curve (not too steep though), but what you get is a DB that can do most things well - YMMV but it kinda becomes your go-to for most applications unless you need something super optimised for a specialised task (as an example, it has indexed JSON fields out of the box, so can easily do exactly the job Mongo is built for). And afaik the comparative slowness is only really apparent when you’ve got lots of read operations, otherwise often as quick (or quicker, for example with geo data). A load more web frameworks added in the option to back with either MySQL or PG over the last few years, and it’s very heavily supported on hosting nowadays, so I guess it’s gotten a lot more traction that way, it used to be a bit of a pig to get running. Can do super interesting stuff with it, it’s rock solid, and it’s standards compliant (and open source, unlike MySQL or MSSQL).

1 Like

I don’t agree that you don’t need to think about structures beforehand with Mongo databases. Good Mongo schemas are well thought out, and libraries like Mongoose are often used to enforce structure. A ‘chuck things in the database’ approach is very likely to cost you some headaches later on :joy:

By the way, does anyone know of a free SQL based database-as-service platform that they’d recommend? I’m thinking of something similar to mLab which I’ve found to be really handy for pet projects.

I prefer SQL, MongoDB for some things.

I am using for UNI where I can have up to 400 MySql databases.

I am dropping here some other free SQL database as a service specific hosts. I don’t know about their quality though:
–> (MySQL)
–> (MySQL)
–> (PostgreSQL as a Service)