I am trying to lay out the architecture for a MEAN.js application that I'm working on and I'm having some trouble deciding how to store some data.
The system will allow users can log in and rate weekly cleaning chores on how happy they would be to have a specific chore assigned to them on any given week. These ratings will be used to optimize chore assignment happiness.
I have the chores and the users set up and ready but I'm unsure how to store user's ratings properly.
I could store the user id with a rating in the chore object, or the chore id with a rating in the user object. If I understand correctly this is a misuse of a non-relational database.
I could create a third database object, "ratings", that would store ratings but it would logically have to refer to the other two objects and this also seemed to be a misuse to me.
Is there another way? Do I need to switch to a relational database? Is one of my ways actually the way it's supposed to be done?
Thanks!
There a lot of other factors that you will have to consider before you can decide what needs to be done here. The modeling the database in mongodb or any NoSQL DB is done based upon the queries that will be used in the system. Try to answer the following questions before you decide anything.
Do not worry about the application level join that you will have to make as they are almost as costly as the DB level join.This might help you gain more understanding.