1

I'm using gridsome, which is pulling data from airtable. I have a table called Nouns, which have a self-referencing hierarchy (any Noun can be either parent or child of any other Noun). I have defined parents only in airtable, and want to write a graphql query for the single detail view (Noun.vue) to find all Nouns that have listed the current one as a parent.

I have tried to use filters, but can't figure out how to filter on a nested object properly. Here's what the query looks like:

query Noun( $path: String!, $parents__id: [String] ) {
  main: noun( path: $path ) {
    id
    path
    name
    parents {
      id
      path
      name
    }
  }
  children: allNoun(filter: { id: { contains: $parents__id }}) {
    edges {
      node {
        id
        path
        name
      }
    }
  }
}

and the markup

<h2>Children</h2>
<ul>
        <li v-for="(node, index) in $page.children.edges" :key="node.id+index">
          <g-link :to="node.path">{{ node.name }}</g-link>
        </li>
      </ul>

I'm not sure what I'm doing wrong here, but continue to get this error: Error: Field "contains" is not defined by type NounFilterIdFilter.

jalx
  • 21
  • 2

0 Answers0