GraphQL pass in an array of IDs

Hi, I am trying to create a graphql query to fetch orders across a range of locations for a specific merchantID.

Here is the query itself:

query OrdersQuery($merchantId: ID!, $locationIds: [ID!]) {
  orders(
    filter: {
      merchants: { equalToAnyOf: [$merchantId] }
      locations: { equalToAnyOf: $locationIds }
    }
  ) {
    nodes {
      id
      lineItems {
        uid
        name
        totalMoney {
          amount
          currency
        }
      }
    }
  }
}

And here are the query variables I am passing in

{
  "locationIds": ["ID1", "ID2"],
  "merchantId": "MERCHANTID"
}

This throws a “Access Denied to field in operation” error. However, this works perfectly:

query OrdersQuery($merchantId: ID!) {
  orders(
    filter: {
      merchants: { equalToAnyOf: [$merchantId] }
      locations: { equalToAnyOf: ["ID1", "ID2"] }
    }
  ) {
    nodes {
      id
      lineItems {
        uid
        name
        totalMoney {
          amount
          currency
        }
      }
    }
  }
}

Not sure if I am missing something simple, thanks in advance!

You need to define the additional location in the query. For example:

query OrdersQuery($merchantId: ID!, $locationId: ID!, $locationIdA: ID!) {
  orders(
    filter: {
      merchants: { equalToAnyOf: [$merchantId] }
      locations: { equalToAnyOf: [$locationId, $locationIdA] }
    }

:slightly_smiling_face: