metaobject with 'collection_reference' returns 'null' in query

vemundeldegard
Visitor
2 0 0

I have an issue with querying metaobjects. I have objects with key collection referencing a collection and name just being text. 

 

Skjermbilde 2023-07-08 kl. 10.53.45.png

 

The query:

 

query {
    metaobjects(type: "brands", first: 10){
        nodes {
            id
            type
            collection: field(key: "collection") {
                value
                type
                reference {
                    __typename
                    ... on Collection {
                        title
                    }
                }
            }
            name: field(key: "name") {
                value
                type
            }
        }
    }
}

 

The response: 

 

 

 

{
    "data": {
        "metaobjects": {
            "nodes": [
                {
                    "id": "gid://shopify/Metaobject/4041507108",
                    "type": "brands",
                    "collection": {
                        "value": "gid://shopify/Collection/450838626596",
                        "type": "collection_reference",
                        "reference": null
                    },
                    "name": {
                        "value": "iUNIK",
                        "type": "single_line_text_field"
                    }
                },
                {
                    "id": "gid://shopify/Metaobject/4041965860",
                    "type": "brands",
                    "collection": {
                        "value": "gid://shopify/Collection/450838069540",
                        "type": "collection_reference",
                        "reference": null
                    },
                    "name": {
                        "value": "Beauty of Joseon",
                        "type": "single_line_text_field"
                    }
                }
            ]
        }
    },
    "extensions": {
        "cost": {
            "requestedQueryCost": 42,
            "actualQueryCost": 9,
            "throttleStatus": {
                "maximumAvailable": 1000.0,
                "currentlyAvailable": 991,
                "restoreRate": 50.0
            }
        }
    }
}

 

 

As you can see the reference does not resolve. What am I doing wrong? 

Reply 1 (1)
vemundeldegard
Visitor
2 0 0

Bump...