Newbie need help

Hi all,

Still learning about dgraph, so here are my problem:

dgraph zero and server up and running (windows 7)

SCHEMA, endpoint /alter, works fine
nodeType: string @index(exact) .
name: string @index(exact, fulltext) @count .
passwd: password .
email: string @index(exact) .
roles: uid .

MUTATION, endpoint: /mutate, works fine
{
set {
_:admin_role “admin” .
_:admin_role “role” .
_:user_role “user” .
_:user_role “role” .
_:public_role “public” .
_:public_role “role” .

_:user1 <nodeType> "user" .
_:user1 <name> "myuser" .
_:user1 <passwd> "password" .
_:user1 <email> "aa@bb.com" .
_:user1 <roles> _:admin_role .
_:user1 <roles> _:user_role .
_:user1 <roles> _:public_role .	

}
}

QUERY, endpoint /query, problem: returning zero result
{ my_data(func: eq(nodeType, “user”))
{
name@.
email
}
}

Query result:

{
“data”: {
“my_data”:
}
}

is there something I do wrong ?

Thank you in advance

are you committing the transaction?

Try read this https://docs.dgraph.io/clients/#run-a-mutation-1

You right, I’m not doing commit.
so all dgraph mutation must reside inside a transaction.

I think it will be nice if information about requirement to commit after mutation also added to dgraph tour page ( https://tour.dgraph.io/schema/2/ )

Thank you MichelDiz

1 Like

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