We use bulk operations to fetch products in some collections.
I’ve noticed that the products in JSONL file is sometimes ordered in unintended order.
Our $query of bulk operation is here.
"{ collections(sortKey: UPDATED_AT, reverse: true, query:\"updated_at:>2022-10-28T05:30:00Z updated_at:<2022-10-29T00:00:00Z title:pt__*\") { edges { node { id productTagId: metafield(namespace: \"product-tag\", key: \"product_tag_id\") { value } products(sortKey: COLLECTION_DEFAULT) { edges { node { id title status } } } } } } }"
We want to get products in COLLECTION_DEFAULT order as you see, but result is not so.
The bulk operation that reproduced this issue’s ID is gid://shopify/BulkOperation/2342505676958.
If not a link between the the apis you can report your content and request to please have it moved to the proper API forum to increase the chances the right people see it.
Spitball doc references - As for your return results being mis-ordered if it’s the Lines in the JSONLthat are out of sequence that could be part of the noted behavior
The GraphQL Admin API doesn’t serially process the contents of the JSONL file. Avoid relying on a particular sequence of lines and object order to achieve a desired result. https://shopify.dev/api/usage/bulk-operations/queries
But there is also this part about persevered order
This would be trivial to reconcile or test for this situation but the GraphQL api has poor platform parity in that there is NO position property there unlike in the rest admin collect api that has a position property. Apparently because the backend teams consider such a thing brittle but don’t consider the utility in data remediation because I guess they think it will always be: " in correctly sorted order".
Thank you for your reply, and sorry about my posting this to wrong forum.
If not a link between the the apis you can report your content and request to please have it moved to the proper API forum to increase the chances the right people see it.
Spitball doc references - As for your return results being mis-ordered if it’s the Lines in the JSONLthat are out of sequence that could be part of the noted behavior
Oh, I missed that notice.
Thank you for pointing this out. I understand about this behavior.
I’ll consider not to rely on the products order on bulk opeartions.