Discussion on: Mongodb-native over mongoose?

tojacob profile image
Jacob Samuel G. Author

If you know well the concurrence of what you are going to build, it is a great advantage.

In my opinion, if your data manages "many to many" relationships you should use relational databases, even for "one to many". You can make complex relationships in mongodb, but you should make several calls to the database to populate the references, which translates into more code lines and more checks. If that does not concern you, then go for mongodb.
As an extra note, with mongoose you do not have to worry about references, since he handles them for you. It's one of his advantages!
I do not like mongoose, but I'm aware that it's very useful.

Mongodb, or any other noSQL, stands out in applications that handle very specific relationships.
Also, it is very useful for applications in constant change and evolution, it works great in methodologies that use the "minimum viable product", since it allows you to modify the flow of data easily, thanks to its flexible scheme.
Another thing that stands out from mongo is its native ability to scale horizontally.

All this is my opinion and experience. I currently use mongo because it works well with nodejs and it was the first thing I learned. However, I want to learn postgreSQL in the future, since a query language has its own benefits.

jenc profile image
jen chan

thanks for sharing your experience. I’ve used mongoose once (forgot about it) and mongo native driver since then. Ive been doing Postgres queries at work and I find that it’s much more semantic than mongo .find() etc but I can see how relationships between tables are very structured to begin with. I’ve yet to see how creating and updating a sql db differs; will have to report back on that one!