This is more of a general GraphQL question I think...
# orm-help
s
This is more of a general GraphQL question I think—is there a way of querying distinct values? Say my query returns [A, B, B, C, C, C], can I just get [A, B, C] or do I just need to turn the results into a set on the frontend?
w
Why can’t you handle this in your resolver, instead of computing it front-end side ?
s
That actually sounds like the best place to do it...I am just new to GQL 😅
w
No worries, I apologize if I sounded harsh ! There are two ways to do this: Either removing your duplicates directly when querying your database (assuming you are querying a database). If you can’t, then just process your data before returning it to your front !
s
You're fine! I appreciate the help 😄
l
You'll find yourself overfetching and reducing quite a bit. In most cases the abstraction is worth it, but if the reduction is too intensive (especially for aggregations), I drop down to the database driver and write a SQL query in the resolver.