How to get data of a type in DQL?

What I want to do

get data of a dql type

What I did

{
  people(func:eq('dgraph.type', 'Person')) {
    name
  }
}

Sorry, your question isn’t clear to me. Can you reformulate it?

Also, both queries below are basically the same.

{
   people(func: eq(dgraph.type, "Person")) {
      name
      dgraph.type
   }
}
{
   people(func: type(Person)) {
      name
      dgraph.type
   }
}

Did you also mean that you want to know the type given a UID?

Something like the _type_ field in GraphQL?

@MichelDiz yes, this is what I want ! query data of a type, I just have not found in the docs.
well I think this is extremely common use case, perhaps it should be presented in the first.
thanks a lot !

Glad to hear that It worked for you. But it is not clear to me what was it. Do you mean the predicate dgraph.type in the query body?

sorry, I just mean the docs, it should be mentioned earlier in the docs,I search several days on it…

@docs I agree with this sentiment. The type system being so fundamental is quite a ways down the doc tree.

@hardik @vvbalaji

1 Like