Hello we are currently building a mini company management & social site in node.js. First of all I'd like to mention that I'm new to mongodb, secondly I'd like to briefly state some database architecture entities so you may advise me or propose the right architecture I should implement on a mongodb database.
The website features:
These are some of the website features. Currently we implemented this with mysql and a orm2 (Object Relational Mapping), however we came to a point were we think that mongodb would be more handy. Also most of the above entities were merged in a single table making it huge and lead me to believe that this is a bad practice.(imagine a table storing instant messages of 100++ users & posts & comments & events & tasks...)
Currently I'm thinking of mongodb database with 4-6 collections keeping the core entities separate and for example merging entities like comments inside the corresponding post in a posts collection.
Question: Is it a bad practice (in a MySQL database innodb for our case) to merge entities under a single table making it huge over time and does this apply in mongodb as well and at what extent? I've also read articles were they used a relational database for users roles and groups and a nosql database to store large amount of data.
PS: I'd appreciate any db collection / architecture proposals.
Merging entities is known as denormalization and has pros and cons. It is usually recommended to denormalize only to address an actual performance issue.
Use a relational database to store relational data. Use a flat structure to store flat data. Full stop. Don't use a truck to run a race, even though a truck has more horse power than a race car.