EdgeQL Tutorial

Polymorphism

Subtopics

In our schema, the abstract type Content is extended by the concrete types Movie and Show, making Content polymorphic: it's a single interface to more than one type.

To make a polymorphic query inside a shape, you can use the is keyword followed by a concrete type, all inside square brackets. For example, to get all the different Content objects starring a particular actor, try:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input

Finally, all the data necessary to render a user's page with their watchlist organized by title and release_year as well as the featured suggestions from above can be packed into a single query:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input

We use ChatGPT with additional context from our documentation to answer your questions. Not all answers will be accurate. Please join our Discord if you need more help.