1

I have a basic collection called Tasks. I want to create a new Collection called DailyTasks, where a DailyTask extends a Task, and also has a list of Dates on which the DailyTask was completed.

I want Tasks.findAll() to return Tasks and DailyTasks.

I would be willing to have three classes: BaseTask, OneTimeTask (which has a single dateCompleted field) and DailyTask (which has a list of datesCompleted). I would need to know how to configure my schema accordingly.

How can I do this?

Laran Evans
  • 1,283
  • 5
  • 15
  • 31

1 Answers1

5

You can pass multiple schemas to the SimpleSchema constructor, and they will be combined. Like so:

Tasks = new SimpleSchema({ ... });

DailyTasks = new SimpleSchema([Tasks, {
  additionalField: {
    type: String
  }
}]);
elhoucine
  • 2,356
  • 4
  • 21
  • 37