Fetch all nodes assigned to a type

What I want to do

i want fetch all nodes of type User

What I did

{
      nodeCount(func: type(User)) {
        uid
        expand(_all_)
      }
    }

Dgraph metadata

NA

dgraph version
[Decoder]: Using assembly version of decoder
Page Size: 4096

Dgraph version   : v20.11.3
Dgraph codename  : tchalla-3
Dgraph SHA-256   : c3c1474369415e74b1a59ec7053cd1e585c9d55fe71243c72c48e313728d995a
Commit SHA-1     : 8d3eb766c
Commit timestamp : 2021-03-31 17:28:12 +0530
Branch           : HEAD
Go version       : go1.15.5
jemalloc enabled : true```

</details>

Does your dataset contain the predicate dgraph.type? with the value “User”?

just added it and now it works

Cool, glad it worked for you.