question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Automatic support for many-to-many fields through linked node creation in source plugins

See original GitHub issue

So in the last few days I tried to get only Wordpress posts with a passed variable (id of a category)… I am creating category sites in gatsby-node, which uses my category template.

Is there a simple way in GraphQL to filter after categories with this plugin? Categories is the only node which is not selectable in the GraphiQL Editor…

{
  allWordpressPost(filter: {categories is not here}) {
    edges {
      node {
        id
        categories {
          id
        }
      }
    }
  }
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
KyleAMathewscommented, Dec 14, 2017

Would love to help someone through a PR to add support for filtering on linked nodes 👍

1reaction
calcsamcommented, Dec 13, 2017

This is a limitation of how you can query many-to-many fields in GraphQL with Gatsby – we don’t automatically create two-way Connection links between nodes pulled in by some plugins, which is required to do the type of querying you discuss.

This would be a bit of a complicated PR and should happen in gatsby core rather than the Wordpress source plugin; feel free to dive in if you’d like.

https://github.com/gatsbyjs/gatsby/blob/57f7b0d372a7461f019ce86a9003371d45204f3b/packages/gatsby/src/schema/build-node-connections.js

Read more comments on GitHub >

github_iconTop Results From Across the Web

AI Search reference - Product Documentation | ServiceNow
These reference topics provide additional information about AI Search installed components, system properties, features, and forms.
Read more >
Many-to-many relationships - Django documentation
To define a many-to-many relationship, use ManyToManyField . What follows are examples of operations that can be performed using the Python API facilities....
Read more >
NetSuite Applications Suite - Custom Plug-in Overview
Install Node.js · Install Gulp.js · Developer Tool Roles and Permissions · Create a Custom Role with Fetch and Deploy Permissions · Assign...
Read more >
Understanding & Using Relations in Strapi
In this article, we will look into the relational fields in Strapi to ... Strapi is an open-source Node.js headless CMS (Content Management ......
Read more >
Customizing the GraphQL Schema - Gatsby
Table of Contents. Explicitly defining data types. The Node interface; Automatic type inference. Creating type definitions. Fixing field types; Opting out of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found