Ask a Question

Query Dgraph types

The list of predicates and node types is retrieved using a query on the /query endpoint.

schema {}
Copy
Note Unlike regular queries, the schema query is not surrounded by curly braces. Also, schema queries and regular queries cannot be combined.

You can query for particular schema fields in the query body.

schema {
  type
  index
  reverse
  tokenizer
  list
  count
  upsert
  lang
}
Copy

You can also query for particular predicates:

schema(pred: [name, friend]) {
  type
  index
  reverse
  tokenizer
  list
  count
  upsert
  lang
}
Copy
Note If ACL is enabled, then the schema query returns only the predicates for which the logged-in ACL user has read access.

Types can also be queried. Below are some example queries.

schema(type: Movie) {}
schema(type: [Person, Animal]) {}
Copy

Note that type queries do not contain anything between the curly braces. The output will be the entire definition of the requested types.

Join our community