A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
What is the difference between these node and nodes?
Looking through the explorer they have the same fields and when I use them I get the same results, but I may be overlooking something.
query MyQuery { orders(first: 1) { nodes{} edges { node{} } } }
Solved! Go to the solution
This is an accepted solution.
Hey @edwinv,
Our GraphQL APIs currently support both the `nodes` and `edges.node` approaches to accessing data, but are generally used for different contexts and needs. Here is a bit more info to expand on the concepts:
How you plan to approach pagination may require some additional investigation into these approaches. Usually, using `nodes` and `pageInfo` would be preferred, but if edge data is necessary, `edges` can be used to return a `cursor` and `node`. I would suggest taking a look into the GraphQL pagination docs here.
Ultimately, the essential object/connection data will be the same, but which approach used will depend on preference and specific needs. I hope this clarification helps - Cheers!
@awwdam | Shopify Developer Support
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
This is an accepted solution.
Hey @edwinv,
Our GraphQL APIs currently support both the `nodes` and `edges.node` approaches to accessing data, but are generally used for different contexts and needs. Here is a bit more info to expand on the concepts:
How you plan to approach pagination may require some additional investigation into these approaches. Usually, using `nodes` and `pageInfo` would be preferred, but if edge data is necessary, `edges` can be used to return a `cursor` and `node`. I would suggest taking a look into the GraphQL pagination docs here.
Ultimately, the essential object/connection data will be the same, but which approach used will depend on preference and specific needs. I hope this clarification helps - Cheers!
@awwdam | Shopify Developer Support
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog