If you have been poking around the queries at this point in the course, you might notice that when you query for a product, you can get all the associated shop information. This is because we defined the @relation
on the Shop
property within Product
. This allowed Fauna to create an index behind the scenes to easily fetch this data.
We haven't done the same for the Product
property on the Shop
so we can't access the data. When we add a new @relation
to Product
we can then grab all the product information from shop queries that we like.
This is based on the Document Model Relationship in Fauna that you can read more about here.
Good introduction to Fauna and GraphQL. Where can I find more examples of Fauna functions to do aggregation similar to MongoDB mongoose.
This might help you with your data aggregation needs: Core FQL concepts part 3: Data aggregation
You can also refer to the documentation here. Let me know if you are looking for specific examples. https://docs.fauna.com/fauna/current/api/fql/