3 ms·
You can do that in EdgeDB: type Movie { property director -> str }; type Book { property author -> str }; type User { multi link favo
by RedCrowbar 7y ago
You can do that in EdgeDB:
type Movie {
property director -> str
};
type Book {
property author -> str
};
type User {
multi link favorites -> Movie | Book
};
SELECT User {
favorites: {
[IS Movie].director,
[IS Book].author,
}
};
- 6gvONxR4sf7o 7y agoCan you tell me whether I'm understanding this correctly? Would this query result in, e.g. [(director: Null, author: J.K Rowling), (director: Spielberg, Null), ...] or would it be [author: J.K. Rowling, director: Spielberg, ...] or just plain strings: [J.K. Rowling, Spielberg, ...]? I still don't totally get the model here.
- RedCrowbar 7y agoIf fetched as JSON: {"favories": [{"director": null, "author": "J.K Rowling"}, {"director": "Spielberg", "author": null}, ...]} You can also query the actual object type by referring to the __type__ link: SELECT User { favorites: { __type__, [IS Movie].director, [IS Book].author, } };
- 6gvONxR4sf7o 7y agoThanks for the clarification! Seems really cool :)