DEV Community

Discussion on: How I improved nested arrays performance in our MongoDB

Collapse
 
mk48 profile image
Kumaran

Can this be resolved simpley if we use traditional RDBMS (MySQL)?
Just create Post, Genere as separate table and link with primary, foreign key and using join in SQL.
As you mentioned that you have experience in MySQL. I think you can describe the situation better.

Normally, I still feel like RDBMS is my go to option. You used MongoDB and MySQL both, so can I get some feedback from you regarding these two?
If you get a chance to rewrite the same project from stratch, will you still choose MongoDB or change to MySQL?

Collapse
 
antmik profile image
Anton

Thanks for the feedback.

Yes, As I mentioned it will require three MySQL tables. Posts, genres, post-genre. Because it's a many-to-many relation. And imagine each post having tags, genres, etc. In MySQL I will have to create at least ten many-to-many tables to connect all subitems to posts.

Regarding your question. If I need to rewrite the project I still gonna choose MongoDB, because it's much comfortable to use on that complex objects I described.

However I would seek for some MongoDB plugin which will automate work with relations. Such as deleting and updating an item. So it will delete/update this item in all references, such as Posts. If I don't find this kind of plugin, I would consider wrting my own.

Collapse
 
mk48 profile image
Kumaran

thanks for the answer. I will give a try to MongoDB.