Ok so I am coming from a mySQL background and am now trying to rebuild a site using nodeJS and Mongoose. My old mySQL schema looked something like this (simplified):
users
user_ID
user_name
user_email
user_password
groups
group_ID
group_name
group_description
groupusers
groupuser_ID
group_ID
user_ID
comments
comment_ID
group_ID
user_ID
comment_txt
Can anyone suggest the best way to restructure this old mySQL schema to work with Mongoose?
If you are worried about the comment size (currently mongodb max document size is 16 mb), you can move it to other doc
In this way you can find the users of the group by
also the groups the user belongs to
if you wanted to retrieve the group relevent info with the above query, i suggest you to store most frequently access group fields also with users.groups, like this