Dgraph GraphQL Tour

Basic

Aliases

The output graph can rename fields in the output using aliases.

Aliases are useful when you want to apply two different filters to the same edge. The example query that’s provided for you in the editor uses aliases to include the friends edge twice, with a unique set of arguments and fields in each case.

Something to try: Query People, then select and alias the xid field as username and alias the query as users. Then, query all people again, filtering for just those with pets, and alias this query as peopleWithPets. See if you can combine these queries into a single operation.

2.12 Aliases