Query according to type classification, and statistics

$ dgraph version

What you wanted to do

I want to query according to the classification of <dgraph.type>,and count the number under each category

What you actually did

Please excuse my poor GraphQL, I can’t get any information, may I ask how to write ?

    <dgraph.type> @groupby(<dgraph.type>){
      a as count(uid)

The error message is as follows:

Error Name: t
Message: : context deadline exceeded
Raw Error:

  "name": "t",
  "url": "",
  "errors": [
      "message": ": context deadline exceeded",
      "extensions": {
        "code": "ErrorInvalidRequest"

Who can help me? :rofl:

Hi @Soultrans
First thing you need to know is that there is a different between dql and GraphQL. The query that you wrote is a dql(Dgraph Query Language). You can execute dql queries using Ratel. Take a look at this tuturial: Dgraph tutorials series - 1: Getting started - Dgraph Blog
The query you need to execute to get this information is something like this:

  getTypes(func: has(dgraph.type)) @groupby(dgraph.type) {

Also the error you got is because your query execution took more than 20 second which is the default query timeout in Ratel and you can see 20s in the url you pasted there.

1 Like