1

I am working with a React component implemented with TypeScript where I am querying some data using gql from apollo-boost library. First time user so have little knowledge.

const GET_COUNTRIES = gql`
  query GET_COUNTRIES {
   users {
    (country)
   }
  }
`;

How to get the distinct countries from this query? Tried with distinct / distinct_on. None of them worked.

Marco Daniel
  • 5,467
  • 5
  • 28
  • 36
PineCone
  • 2,193
  • 12
  • 37
  • 78
  • GraphQL has no built-in sorting/filtering. It's up to the server to implement features like that. You would have to consult your API's documentation to see if that field takes any arguments like that. Some tools or frameworks like Graphcool or Gatsby **do** have built-in filtering. If you are using something like that, then you should clarify that in your question. – Daniel Rearden Feb 28 '19 at 14:12

0 Answers0