I'm new to graphql, I have some users that can follow each other and they have a list of products, what would be the way to go to create a feed of products of the users you follow?
The user
has a property called listing
that has a relation to the products
(which has a relation to the user with a property called author
)
Basically the user looks like this:
User object{ ... listing: [ "id1", "id2" ]}
and the product like this:
Product object{ ... author: { User1 }}
what would be the best approach to write a query to get the products from the followed users?
other maybe useful information:
- the data is stored in a mongodb database
- the
listings
and theauthor
are stored as ids but can be populated with the full object
thanks!