Objects
EdgeDB allows for various relationships to be established between objects by using links. Accessing links is very similar to accessing properties. However, an important thing to remember is that following links always results in a set of objects (without duplicates), unlike properties. For example, to query all the content on the watchlists of all the users try:
In the example above, Account.watchlist
links to the Content
objects linked from each Account
, and the Content
type has a
property called title
that we chose to display.
Links in EdgeDB are directional, but they can be
traversed in reverse direction and refer to the object
at the start of a link by using the .<
instead of .
.
We call this a backlink. When following a backlink it is
best to specify the type of the object at the source
using [is SomeType]
. For example, to get all those
users who have some Content
on their watchlists try: