David Mráz
Jan 27 · 1 min read

Hi Luce, thanks for your question! I am not sure if I understand your question correctly. If I am talking about something else just let me know.

If you want to get for example only admins, you will just specify the query as follows

query getUsers { 
admins: users(role: admin) {
…userFields
}
}
// you should get just admins, should be accesible in "response.data.admins"

However, you can also use the query without aliases.

query getUsers { 
users(role: admin) {
…userFields
}
}
// you should get also only admins, should be accesible in "response.data.users"

The data are filtered on the server in the resolver function logic based on the argument “role”. If you still receive all the users with this queries, the logic needs to be fixed on the server in the resolver function. I will check out the example repo if everything is working correctly.

David Mráz

Written by

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade