Using GraphQL after setting data through DQL returns no results

You need to add in the dgraph.type predicate

https://dgraph.io/docs/query-language/type-system/#setting-the-type-of-a-node

But your data is not typed…

Should be:

[
  {
    "dgraph.type": "User",
    "User.email": "user1@hotmail.com",
  },
  {
    "dgraph.type": "User",
    "User.email": "user2@gmail.com",
  },
  {
    "dgraph.type": "User",
    "User.email": "user3@gmail.com",
  }
]

You could alternatively run an upsert mutation that adds the dgraph.type for all nodes that have the User.email predicate already.

3 Likes