How can I return all nodes of a certain type?

You might not have included the type of each node when inserting it. You can check by querying for dgraph.type

{
  q(func: uid(<some_uid>)) {
    uid
    dgraph.type
  }
}

So your type definition in Go should look something like the following:

type Person struct {
	UID         string                 `json:"uid,omitempty"`
    Name        string                 `json:"name,omitempty"`
	DgraphType  []string               `json:"dgraph.type,omitempty"`
}
1 Like