The following is my schema, I did not specify the ID type, but used the @id directive to implement a custom id:
type User {
id: String! @id
name: String
}
Now add user:
mutation{
addUser(
input:[
{
id:"23546563",
name:"jack"
}
]
){
user{
id
name
}
}
}
Now query the user list, it gets successful:
query{
queryUser{
id
name
}
}
The results:
"data": {
"queryUser": [
{
"id": "23546563",
"name": "jack"
}
]
},
But when I query based on getUser
an error occurred:
query {
getUser(id:"23546563") {
id
name
}
}
Get error:
"errors": [
{
"message": "Dgraph query failed because Dgraph execution failed because line 2 column 19: Invalid use of comma."
}
],
It seems that there is a code error in the source code.
I tried to specify the id query in queryUser
, it was successful, getUser
is an exception:
query{
queryUser(
filter:{
id: { eq: "23546563"}
}
){
id
name
}
}
The results:
"data": {
"queryUser": [
{
"id": "23546563",
"name": "jack"
}
]
}