1. 16
    Add a Product Relation to Shop to understand Document Model Relationship in Fauna
    2m 11s

Add a Product Relation to Shop to understand Document Model Relationship in Fauna

InstructorShadid Haque

Share this video with your friends

Send Tweet

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.

~ 2 years ago

Good introduction to Fauna and GraphQL. Where can I find more examples of Fauna functions to do aggregation similar to MongoDB mongoose.

Zac Jones
~ 2 years ago

This might help you with your data aggregation needs: Core FQL concepts part 3: Data aggregation

Shadid Haqueinstructor
~ 2 years ago

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/