You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When looking at the example code for the Nested Resources section, PARENT and CHILD refer to two Mongoose objects that handle two separate MongoDB collections. I confirmed this when running the code, as an empty Child collection was created in my database.
However, would there be a way to nest resources, using instead a document + subdocument like the following?
With something along these lines defining their relationship in Mongoose:
var ChildSchema = new mongoose.Schema({
// variables + id
});
var ParentSchema = new mongoose.Schema({
// parent variables, id
child: [ChildSchema]
});
In other words, I'd like to know if the parent and child REST interfaces can be defined with Resource() so that they refer to the main document and its nested contents.
Thanks for reading!
The text was updated successfully, but these errors were encountered:
Update: This could be chalked up to my relative inexperience with this library, so I posted the following question on Stack Overflow, where I try to break down the results I experience trying to implement the concept I describe above:
When looking at the example code for the Nested Resources section, PARENT and CHILD refer to two Mongoose objects that handle two separate MongoDB collections. I confirmed this when running the code, as an empty Child collection was created in my database.
However, would there be a way to nest resources, using instead a document + subdocument like the following?
With something along these lines defining their relationship in Mongoose:
In other words, I'd like to know if the parent and child REST interfaces can be defined with Resource() so that they refer to the main document and its nested contents.
Thanks for reading!
The text was updated successfully, but these errors were encountered: