I'm trying to add seed data using mongo-migrate. The problem I'm running into is that I want to add a subdocument as defined here. Subdocuments also have an _id field, but I'm not sure how to make that work. For example, I have a TimelineItem model which has a notes subdocument (which comes from noteSchema), but the only way I can add a new document to the timelineitems collection (and kind of emulating a subdocument) is to say timelineitems.insert({notes: [{//first note}, {//second note}]) but I don't think that captures the structure of the subdocument (like it doesn't have an _id etc.).
I'm trying to add seed data using
mongo-migrate
. The problem I'm running into is that I want to add a subdocument as defined here. Subdocuments also have an_id
field, but I'm not sure how to make that work. For example, I have aTimelineItem
model which has anotes
subdocument (which comes fromnoteSchema
), but the only way I can add a new document to thetimelineitems
collection (and kind of emulating a subdocument) is to saytimelineitems.insert({notes: [{//first note}, {//second note}])
but I don't think that captures the structure of the subdocument (like it doesn't have an_id
etc.).How should I make this work?