Hi, I’ve got a Meteor app which is going to hit alpha version soon and looking back to what I have created so far I am starting to get doubts on which would be the best approach for the app.
Shortly, the app is a project manager where users can create projects, and then set parts, expenses and events for that project (keeping the description simple for the sake of lenght). So I have two approaches in mind:
Multiple collections (What I have now):
- Projects, parts, expenses and events all have separate collection.
- Parts, expenses and events have a ‘project’ field which references the _id of the project they belong to.
- On a typical page of the app, I have a lower level template which subscribes to the chosen project, and higher level templates which subscribes to the parts, expenses, or events for that project (based on which route the user is in)
Embedded documents:
- Have just one collection for the projects
- Projects’s parts, events and expenses are nested inside the project (e.g.
project: { parts: [{...},{...}], expenses: [{...},{...}], events: [{...},{...}]}
- On each page, I will just subcribe to the chosen project and render the different data based on which route the user is in
One one side I don’t want to fall into the ‘death by planning’ trap and would rather just ship what I have, on the other side this seems like a common situation in meteor projects that many developer have likely faced, so I ask: in a production environment, which approach is best suited to the usage my app would have? How would performance be affected in one against the other?
Thanks in advance