Weβre overhauling Dgraphβs docs to make them clearer and more approachable. If
you notice any issues during this transition or have suggestions, please
let us know.
- The name of the DQL query that you want to map to the GraphQL response, should be same as the name of the GraphQL query.
- You must use proper aliases inside DQL queries to map them to the GraphQL response.
- If you are using variables in DQL queries, their names should be same as the name of the arguments for the GraphQL query.
- For variables, only scalar GraphQL arguments like
Boolean,Int,Float, etc are allowed. Lists and Object types arenβt allowed to be used as variables with DQL queries. - You would be able to query only those many levels with GraphQL which you have mapped with the DQL query. For instance, in the first custom query in this example, we havenβt mapped an authorβs tweets to GraphQL alias, so, we wonβt be able to fetch authorβs tweets using that query.
- If the custom GraphQL query returns an interface, and you want to use
__typenamein GraphQL query, then you should adddgraph.typeas a field in DQL query without any alias. This isnβt required for types, only for interfaces. - to subscribe to a custom DQL query, use the
@withSubscriptiondirective. See the Subscriptions article for more information.