Whats the alternative to use where clause in Apollo server

I have a graph which returns a few props along with array of Json obj

I want to return only specific name value pairs from attributes which can be accepted as input rather than the entire list of attributes

query ExampleQuery($fulfillerId: String!, $decorationTechnology: String!) {
  fulfillmentItemsFromFI(fulfillerId: $fulfillerId, decorationTechnology: $decorationTechnology) {
    associatedItems {
      itemDetails {
         attributes {
          name
          value
        }
      }
    }
  }
}
"data": {
    "fulfillmentItemsFromFI": [
      {
        "itemDetails": {
          "attributes": [
            {
              "name": "config",
              "value": "some_Congif_value"
            },
            {
              "name": "orderId",
              "value": "BNKTES372"
            },
            {
              "name": "url",
              "value": "https://api.tested.com"
            },
          }
        }

Expected output JSON where I only want configData in attributes for all responses

"data": {
    "fulfillmentItemsFromFI": [
      {
        "itemDetails": {
          "id" : 1
          "attributes": [
            {
              "name": "configData",
              "value": "some_Congif_value"
            }
          },
      "id" : 2
          "attributes": [
            {
              "name": "configData",
              "value": "some_Congif_value_2"
            }
        }

Hey @Aagam_Doshi, you should be able to accomplish this with arguments. If your attributes field took an argument (like name), then your attributes resolver can look for that argument to filter the results that it returns.

query ExampleQuery($fulfillerId: String!, $decorationTechnology: String!, $attributeName: String) {
  fulfillmentItemsFromFI(fulfillerId: $fulfillerId, decorationTechnology: $decorationTechnology) {
    associatedItems {
      itemDetails {
         attributes (attributeName: $attributeName) {
          name
          value
        }
      }
    }
  }
}

You can also hardcode this to configData in the query if you know that’s all your query would ever be looking for.

Hope that helps!

If you use arguments, you should be able to do this. As long as your attributes field accepts arguments (for example, name), the attributes resolver will filter the results by looking for that argument.