I’m a noob at dgraph and I’m having trouble with this query.
I have two predicates: user and city, where a user can have multiple cities (all the cities they lived in).
I’m trying to write a query where, given a user id, I can find all the users that also have lived in a city that the user with the user id has lived in. In SQL I would join users by their cities, but I’m not sure how to do it with dgraph.
{
MyUser(func: uid(0x1) {
uid
user.name
user.public_id
email
~user.city {
city.name
city.public_id
user.city { #In this case you should filter this level, otherwise you may receive thousands of results from that city.
uid
user.name
user.public_id
email
}
}
}
}