Population
Comments of a post of a user
Use the populate()
operator to apply population to your resource.
Imagine the following scenario:
Now if you want to display the user's name for every post in your list, you can use the populate()
operator.
You can also fetch all comments for a post and then every user for every comment.
The populate() route instruction
Getting every post's user
When opening /with-user
, it will load all posts and then all users of the loaded posts. If you are using PaginatedHttpCollection, it will do so for every page you load.
Getting one post's comments
The same configuration would also work if you would change getActive() to getMany(). This would, however, populate all comments of every post loaded by getMany().
Last updated