My background is front-end and I’m currently working on my first Meteor project. Im loving how quickly I can build out the back-end I want to make sure I’m following best practice around a few things.
Im making a social network with groups. Each group can have events. Users can join groups and also join events.
I have separate collections for users, groups and events.
A user has fields for groups and events they are attending. Ive manually set the group IDs as they are predefined, but users can create events so Im using Meteor’s _id field for these:
{
name: 'James Smith',
group: [1,2,4],
events: [‘nca45R4um67RQDBSG’, ’GKs3bFv9BipJkyxr3’]
}
Events have a field showing which group they are part of:
{
name: ‘some event’,
location: ‘somewhere’,
group: 2
}
On a group page I need to show all the upcoming events from that group and all the users who have joined the group. Im loading all of the events and users into the React component and then filtering by the group field to determine which ones to show on the page.
On the event page I also need to show all the users who are going. So again I load all of the users into the React component, but this time filter by the events field.
This is working fine for me as I develop locally but is this likely to scale?
I also need to allow users to comment on both groups and events. If I have a new collection for comments this could get very large over time. Is there a rule of thumb around performance for database sizes / organisation?
Thanks!