I use Mongoose.js and cannot solve problem with 3 level hierarchy document.
There 2 ways to do it.
First - without refs.
C =
I'm late to this, but I wrote a Mongoose plugin that makes it extremely simple to perform deep model population. For your example, you can do this to populate b and c:
A.find({}, function (err, docs) {
A.deepPopulate(docs, 'b.c', cb)
}
You can also specify Mongoose populate options for each of the populated paths, like this:
A.deepPopulate(docs, 'b.c', {
b: {
select: 'name'
}
}, cb)
Check out the plugin documentation for more information.