Hot to query schema type of node

Hey there,

How can I get the type of a node? E.g. in my schema I have types “Person”, “Post”, “Comment”, … How can I return the value of a type, not a predicate?

{
q(func: regexp(name, /.*new.*/i)) {
    name
    uid
    type # ← not the predicate "type" but the node’s type
  }
}

My workaround is currently an additional type predicate for every type.

Use “dgraph.type” in your query.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.