Your code looks fine as long as it is readable, so don’t worry.
For the future, to insert code, either paste it, mark and use preformatted text button or use tripple grave accent in a line before the code and in a line after the code.
As for the question, is there a particular reason for which your company doesn’t denormalize such data? Perhaps this data structure was migrated from another database?
If you don’t want to denormalize, I can suggest using publish-composite package which can help you to publish related data like yours.
Structure: Before we continue, can you give us the record structure (fields) of the collections ala Simple Schema?
Scope: And which questions do you want? You wrote, “given a certain question, I need to know all of the questions that follow”.
Follow in what, in the group? the page? the book?
Schema.Question = new SimpleSchema({
group_id: { type: String },
sort_order: { type: Number },
text: { type: String },
...
)};
Schema.Question_Group = new SimpleSchema({
page_id: { type: String },
sort_order: { type: Number },
...
)};
Schema.Page = new SimpleSchema({
sort_order: { type: Number },
...
)};
Scope:
In my UI, I start with a list of all of the questions on a page (each question is a collapsible header). For each question (in the collapsible-body) I want the user to be able to select a future question (as part of a form).
I am new to document databases, and you are likely seeing the influence of my relational database history.
I have posting some of the schema for Questions, Question_Groups and Pages here. I’m interested, how do you think I could be more efficient? I welcome any tutelage you may offer.