Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Get Metaobject reference within another Metaobject GraphQL query

Get Metaobject reference within another Metaobject GraphQL query

jldt
Tourist
4 1 1

Hi, I'm seeing null when trying to access a Metaobject reference, within a Metaobject query.

The referenced object contains the category name, which is essential to my cause.  There is 1 reference on each entry.

Is my structure OK for referencing this?

{
  metaobjects(type: "my_text", first: 50) {
    nodes {
      handle
      field(key: "body_text") {
        value
        references(first: 1) {
          edges {
            node {
              ... on Metaobject {
                id
                type
                fields {
                  key
                  value
                }
              }
            }
          }
        }
      }
      
    }
  }
}


Result:

"data": {
    "metaobjects": {
      "nodes": [
        {
          "handle": "xxxxxxxxxxxxx",
          "field": {
            "value": "Item 1",
            "references": null
          }
        },
        {
          "handle": "xxxxxxxxxxxx",
          "field": {
            "value": "Item 2",
            "references": null
          }
        }
    }
}
Replies 0 (0)