0

Not sure if the title is correct, but what i am trying to do is:

First page "create job" - Jobs are created (form post) Second page "Add tasks to job" - Task for a specific job is added.

This is my mongoose schema:

var jobSchema = new mongoose.Schema({
  user : {type : mongoose.Schema.ObjectId, ref : 'User', required: true},
  name : {type: String, required: true},
  description: String,
  tasks : [{
   name: {type: String},
   status: {type: String}
  }]
})

var Jobs = mongoose.model('Jobs', jobSchema);

Shall i put the task as objects in the document (like above) or shall I put the task in a separate document and reference them?

How can I get the .id/reference the tasks?

James Bund
  • 183
  • 2
  • 14

0 Answers0