Hello. I’m still a newbie and I’m working on my first production app (I’ve only been a hobbyist until this project). I have a question about designing my database and the performance in Meteor/MongoDB…
As an example, consider the Todos sample application. There is a Tasks database with the individual tasks and a Lists database with each user list. When creating a task, the _id of the List that it belongs to is entered.
What is the best way to design my database if I will not have user lists, but a fixed set of lists defined by the application? Some of the lists may be separate, some are auto generated, and tasks could belong to more than one of these at a time. For example:
- Inbox
- Today
- All Tasks
A task could be in the Inbox
or All Tasks
, but not both at the same time. A task with a due date of today will appear in All Tasks
, but would automatically be included in the Today
list as well.
I think it makes the most sense to have a single list and use fields to designate Inbox
vs All Tasks
, and then a database search that would retrieve tasks with a due date of Today
. If I do that, should I just use the list names, or somehow generate a unique key? (And how would I do that for a fixed set of application-defined lists?)
What about performance? Would these possible more complex searches cause performance problems, or am I overthinking this?
In case it make a difference to the answer, this is a Meteor-React app. Thanks in advance!
Ken