I\'m trying to query inside an embedded document that is nested. I\'ve attempted to \'populate\' the results but that fails.
How do I get back all of the book detail
right now nested sub document population is not supported. i added a link to this post to the open github issue for future tracking.
https://github.com/LearnBoost/mongoose/issues/601
Deep population was added in Mongoose 3.6. https://github.com/LearnBoost/mongoose/issues/1377#issuecomment-15911192
For your example, it would be something like:
Owner.find().populate('shelves').exec(PopulateBooks);
function PopulateBooks(err, owners) {
if(err) throw err;
// Deep population is here
Book.populate(owners, { path: 'shelves.books' }).exec(callback);
}