I've recently started learning about graphql and I have a group of users who can follow each other. Each user also has a list of products. How can I create a feed that displays the products of the users I follow?
The user
object includes a property called listing
, which is related to the products
(which, in turn, are related to the user through the author
property)
A typical user object looks like this:
User object
{
...
listing: [ "id1", "id2" ]
}
And a product object looks like this:
Product object
{
...
author: { User1 }
}
What would be the most effective method for querying and retrieving products from followed users? Any additional helpful information:
- The data is stored in a mongodb database
- The
listings
and theauthor
are stored as ids but can be retrieved with the complete object
Thank you!