Bulk Operation Connections are limited to first 100

I am performing a bulk operation to get discount nodes, and I want to get all associated codes in the connection. The documentation clearly states that

The first argument is optional and ignored if present, so it can be removed.

I am running the bulk operation using the new 2025-04 release, and the associated codes to the discount are capping at 100. How can I get all the associated codes in one bulk operation? If I can’t specify “first”, I would expect to get all items.

Hi Erin,

Can you share the query you’re trying (without including any sensitive info)?

Hi @Liam-Shopify

This is the query

query:  
  mutation {
    bulkOperationRunQuery(
      query: """
      {
        discountNodes(
          sortKey: UPDATED_AT,
          reverse: true,
          query: "times_used:>=1 updated_at:>=2025-04-01T00:00:00.000Z updated_at:<=2025-04-07T00:00:00.000Z"
        ) {
          edges {
            node {
              id
              discount {
                ... on DiscountCodeBasic {
                  appliesOncePerCustomer
                  summary
                  usageLimit
                  recurringCycleLimit
                  __typename
                  title
                  asyncUsageCount
                  discountClass
                  combinesWith {
                    orderDiscounts
                    productDiscounts
                    shippingDiscounts
                  }
                  startsAt
                  endsAt
                  createdAt
                  updatedAt
                  status
                  totalSales {
                    amount
                  }
                  customerGets {
                    appliesOnOneTimePurchase
                    appliesOnSubscription
                    value {
                      ... on DiscountAmount {
                        __typename
                        amount {
                          amount
                          currencyCode
                        }
                        appliesOnEachItem
                      }
                      ... on DiscountOnQuantity {
                        __typename
                        effect {
                          ... on DiscountAmount {
                            __typename
                            amount {
                              amount
                              currencyCode
                            }
                            appliesOnEachItem
                          }
                          ... on DiscountPercentage {
                            __typename
                            percentage
                          }
                        }
                        quantity {
                          quantity
                        }
                      }
                      ... on DiscountPercentage {
                        __typename
                        percentage
                      }
                    }
                    items {
                      ... on AllDiscountItems {
                        __typename
                        allItems
                      }
                    }
                  }
                  codes(query: "times_used:>=1") {
                    edges {
                      node {
                        code 
                        id 
                      }
                    }
                  }
                  minimumRequirement {
                    ... on DiscountMinimumQuantity {
                      __typename
                      greaterThanOrEqualToQuantity
                    }
                    ... on DiscountMinimumSubtotal {
                      __typename
                      greaterThanOrEqualToSubtotal {
                        amount
                      }
                    }
                  }
                }
                ... on DiscountCodeBxgy {
                  appliesOncePerCustomer
                  summary
                  usesPerOrderLimit
                  usageLimit
                  __typename
                  title
                  asyncUsageCount
                  discountClass
                  combinesWith {
                    orderDiscounts
                    productDiscounts
                    shippingDiscounts
                  }
                  startsAt
                  endsAt
                  createdAt
                  updatedAt
                  status
                  totalSales {
                    amount
                  }
                  customerGets {
                    appliesOnOneTimePurchase
                    appliesOnSubscription
                    value {
                      ... on DiscountAmount {
                        __typename
                        amount {
                          amount
                          currencyCode
                        }
                        appliesOnEachItem
                      }
                      ... on DiscountOnQuantity {
                        __typename
                        effect {
                          ... on DiscountAmount {
                            __typename
                            amount {
                              amount
                              currencyCode
                            }
                            appliesOnEachItem
                          }
                          ... on DiscountPercentage {
                            __typename
                            percentage
                          }
                        }
                        quantity {
                          quantity
                        }
                      }
                      ... on DiscountPercentage {
                        __typename
                        percentage
                      }
                    }
                    items {
                      ... on AllDiscountItems {
                        __typename
                        allItems
                      }
                    }
                  }
                  customerBuys {
                    value {
                      ... on DiscountPurchaseAmount {
                        __typename
                        amount
                      }
                      ... on DiscountQuantity {
                        __typename
                        quantity 
                      }
                    }
                    items {
                      ... on AllDiscountItems {
                        __typename
                        allItems
                      }
                    }
                  }
                  codes(query: "times_used:>=1") {
                    edges {
                      node {
                        code 
                        id 
                      }
                    }
                  }
                }
                ... on DiscountCodeFreeShipping {
                  summary
                  appliesOnOneTimePurchase
                  appliesOnSubscription
                  recurringCycleLimit
                  usageLimit
                  __typename
                  title
                  asyncUsageCount
                  discountClass
                  combinesWith {
                    orderDiscounts
                    productDiscounts
                    shippingDiscounts
                  }
                  startsAt
                  endsAt
                  createdAt
                  updatedAt
                  status
                  codes(query: "times_used:>=1") {
                    edges {
                      node {
                        code 
                        id 
                      }
                    }
                  }
                  destinationSelection {
                    ... on DiscountCountries {
                      __typename
                      countries
                      includeRestOfWorld
                    }
                    ... on DiscountCountryAll {
                      __typename
                      allCountries
                    }
                  }
                  minimumRequirement {
                    ... on DiscountMinimumQuantity {
                      __typename
                      greaterThanOrEqualToQuantity
                    }
                    ... on DiscountMinimumSubtotal {
                      __typename
                      greaterThanOrEqualToSubtotal {
                        amount
                      }
                    }
                  }
                  maximumShippingPrice {
                    amount
                    currencyCode
                  }
                  totalSales {
                    amount
                  }
                }
                ... on DiscountCodeApp {
                  appliesOncePerCustomer
                  appliesOnOneTimePurchase
                  appliesOnSubscription
                  usageLimit
                  recurringCycleLimit
                  __typename
                  title
                  asyncUsageCount
                  discountClass
                  combinesWith {
                    orderDiscounts
                    productDiscounts
                    shippingDiscounts
                  }
                  startsAt
                  endsAt
                  createdAt
                  updatedAt
                  status
                  totalSales {
                    amount
                  }
                  appDiscountType {
                    app {
                      title
                      description
                    }
                    title
                    description
                  }
                  codes(query: "times_used:>=1") {
                    edges {
                      node {
                        code 
                        id 
                      }
                    }
                  }
                }
                ... on DiscountAutomaticBasic {
                  summary
                  recurringCycleLimit
                  __typename
                  title
                  asyncUsageCount
                  discountClass
                  combinesWith {
                    orderDiscounts
                    productDiscounts
                    shippingDiscounts
                  }
                  startsAt
                  endsAt
                  createdAt
                  updatedAt
                  status
                  customerGets {
                    appliesOnOneTimePurchase
                    appliesOnSubscription
                    value {
                      ... on DiscountAmount {
                        __typename
                        amount {
                          amount
                          currencyCode
                        }
                        appliesOnEachItem
                      }
                      ... on DiscountOnQuantity {
                        __typename
                        effect {
                          ... on DiscountAmount {
                            __typename
                            amount {
                              amount
                              currencyCode
                            }
                            appliesOnEachItem
                          }
                          ... on DiscountPercentage {
                            __typename
                            percentage
                          }
                        }
                        quantity {
                          quantity
                        }
                      }
                      ... on DiscountPercentage {
                        __typename
                        percentage
                      }
                    }
                    items {
                      ... on AllDiscountItems {
                        __typename
                        allItems
                      }
                    }
                  }
                  minimumRequirement {
                    ... on DiscountMinimumQuantity {
                      __typename
                      greaterThanOrEqualToQuantity
                    }
                    ... on DiscountMinimumSubtotal {
                      __typename
                      greaterThanOrEqualToSubtotal {
                        amount
                      }
                    }
                  }
                }
                ... on DiscountAutomaticBxgy {
                  summary
                  usesPerOrderLimit
                  __typename
                  title
                  asyncUsageCount
                  discountClass
                  combinesWith {
                    orderDiscounts
                    productDiscounts
                    shippingDiscounts
                  }
                  startsAt
                  endsAt
                  createdAt
                  updatedAt
                  status
                  customerGets {
                    appliesOnOneTimePurchase
                    appliesOnSubscription
                    value {
                      ... on DiscountAmount {
                        __typename
                        amount {
                          amount
                          currencyCode
                        }
                        appliesOnEachItem
                      }
                      ... on DiscountOnQuantity {
                        __typename
                        effect {
                          ... on DiscountAmount {
                            __typename
                            amount {
                              amount
                              currencyCode
                            }
                            appliesOnEachItem
                          }
                          ... on DiscountPercentage {
                            __typename
                            percentage
                          }
                        }
                        quantity {
                          quantity
                        }
                      }
                      ... on DiscountPercentage {
                        __typename
                        percentage
                      }
                    }
                    items {
                      ... on AllDiscountItems {
                        __typename
                        allItems
                      }
                    }
                  }
                  customerBuys {
                    value {
                      ... on DiscountPurchaseAmount {
                        __typename
                        amount
                      }
                      ... on DiscountQuantity {
                        __typename
                        quantity 
                      }
                    }
                    items {
                      ... on AllDiscountItems {
                        __typename
                        allItems
                      }
                    }
                  }
                }
                ... on DiscountAutomaticFreeShipping {
                  appliesOnOneTimePurchase
                  appliesOnSubscription
                  recurringCycleLimit
                  summary
                  __typename
                  title
                  asyncUsageCount
                  discountClass
                  combinesWith {
                    orderDiscounts
                    productDiscounts
                    shippingDiscounts
                  }
                  startsAt
                  endsAt
                  createdAt
                  updatedAt
                  status
                  destinationSelection {
                    ... on DiscountCountries {
                      __typename
                      countries
                      includeRestOfWorld
                    }
                    ... on DiscountCountryAll {
                      __typename
                      allCountries
                    }
                  }
                  maximumShippingPrice {
                    amount
                    currencyCode
                  }
                  minimumRequirement {
                    ... on DiscountMinimumQuantity {
                      __typename
                      greaterThanOrEqualToQuantity
                    }
                    ... on DiscountMinimumSubtotal {
                      __typename
                      greaterThanOrEqualToSubtotal {
                        amount
                      }
                    }
                  }
                  totalSales {
                    amount
                  }
                }
                ... on DiscountAutomaticApp {
                  appliesOnSubscription
                  recurringCycleLimit
                  __typename
                  title
                  asyncUsageCount
                  discountClass
                  combinesWith {
                    orderDiscounts
                    productDiscounts
                    shippingDiscounts
                  }
                  startsAt
                  endsAt
                  createdAt
                  updatedAt
                  status
                  appDiscountType {
                    app {
                      title
                      description
                    }
                    title
                    description
                  }
                }
              }
            }
          }
        }
      }
      """
    ) {
      bulkOperation {
        id
        status
      }
      userErrors {
        field
        message
      }
    }
  }