title: Gatsby.js: Filter GraphQL query by nested object property
body: <p>I'm working on a news site which will have articles, each with one or multiple respective authors. If you click on an author's name, it will take you to a page displaying their information and a list of articles they have contributed to.</p>
  
  <p>So each article has an <code>authors</code> property, which in turn is an array of <code>author</code> objects with properties: full name, slug (<em>lowercase version of full name with spaces replaced by dashes</em>), etc.</p>
  
  <p>Is it possible to filter the articles by a particular author's slug when defining the query?</p>
  
  <pre><code>query authorQuery($slug: String!) {
    allContentfulArticle(filter: { //not sure what to do here }) {
      edges {
        node {
          title
          slug
          authors {
            name
            slug
          }
        }
      }
    }
  }
  </code></pre>
  
  <p>My other option would be to load all of the articles, then setup a filter in the component like so:</p>
  
  <pre><code>const articles = data.allContentfulArticle.edges.filter(({ node }) =&gt; {
    return node.authors.some((author) =&gt; author.slug === data.contentfulAuthor.slug);
  });
  </code></pre>
  
  <p>This wouldn't be the end of the world, however it goes against the GraphQL principle of only loading the data you need.</p>