Problem with graphql @index directive

I’m trying to add an index GraphQL query

I created the Index (works well in FQL),

  name: 'quotes_reversed',
  source: Collection('Quote'),
  values: [{ field: ['ref'], reverse: true }],

and then added in my GraphQL schema

quotesReversed: [Quote] @index(name: "quotes_reversed")

but when I try to UPDATE SCHEMA in Fauna’s console, it says:

“Error updating GraphQL schema.: Instance data is not valid”

I’m not sure if it’s my fault or is it a bug

You cannot specify values for an Index used with @index.

The error is not very helpful, but it is working as intended. Not a bug, but perhaps unfortunate that it cannot work.

There is a Topic for feedback on this, and also suggests a workaround of using a UDF with @resolver.

1 Like