I have a document structure in MongoDB like this:
User
|---> Posts
|----> Comments
So, a parent document User with a collection of embedded Post documents, which itself has a collection of embedded Comment documents.
I grab the User document back and now have the entire document tree in memory, like so:
user = User.where(username: 'test').first
From user how can I get a list of all the comments?
Try something like this:
Or