Something similar to this:
Schema
type User {
email: string
username: string
at: string
name: string
}
Mutation
{
"set": [{
"name": "Simon Cowell",
"username": "SimonX",
"email": "simon",
"at": "itv.com",
"dgraph.type": "User"
},
{
"name": "Jeremy Clarkson",
"username": "JeremyCars",
"email": "jeremy",
"at": "bbcstudios.com",
"dgraph.type": "User"
},
{
"name": "Jude Law",
"username": "judelaw",
"email": "judelaw",
"at": "imdb.com",
"dgraph.type": "User"
}
]
}
Query
{
G as var(func: type(User)) {
U as username
}
query(func: uid(G)) @filter(not eq(email, val(U)) ) {
test: val(U)
uid
name
username
email
at
}
}
Result (with Var result)
{
"data": {
"var": [
{
"email": "simon",
"username": "SimonX"
},
{
"email": "jeremy",
"username": "JeremyCars"
},
{
"email": "judelaw",
"username": "judelaw"
}
],
"query": [
{
"test": "SimonX",
"uid": "0xe30f",
"name": "Simon Cowell",
"username": "SimonX",
"email": "simon",
"at": "itv.com"
},
{
"test": "JeremyCars",
"uid": "0xe310",
"name": "Jeremy Clarkson",
"username": "JeremyCars",
"email": "jeremy",
"at": "bbcstudios.com"
}
]
}
}