#StackBounty: #8 Filtering on child properties in GraphQL

Bounty: 500

I am using GraphQL to get a list of upcoming events. I am having trouble finding the correct way to filter on the date value which is a child of my date field.

The query, which works:

query getUpcomingEvents {
  nodeQuery(
    filter: {
      conditions: [
        {operator: EQUAL, field: "type", value: ["ain_event"]},
        {operator: EQUAL, field: "status", value: ["1"]} 
      ]
    }
  )
  {
    entities {
      entityLabel
      ...on NodeAinEvent {
        fieldAinEventLocation
        fieldAinEventDate {
          startDate
          endDate
        }
        fieldAinLink {
          uri
        }
      }
    }
  }
}

I get this response:

 {
  "data": {
    "nodeQuery": {
      "entities": [
        {
          "entityLabel": "EAA AIRVENTURE",
          "fieldAinEventLocation": "OshKosh, WI",
          "fieldAinEventDate": {
            "startDate": "2021-07-26 12:00:00 UTC",
            "endDate": "2021-08-01 12:00:00 UTC"
          },
          "fieldAinLink": {
            "uri": "http://www.eaa.org/en/airventure"
          }
        },
        {
          "entityLabel": "FlightSimExpo",
          "fieldAinEventLocation": "San Diego, CA",
          "fieldAinEventDate": {
            "startDate": "2021-09-24 12:00:00 UTC",
            "endDate": "2021-09-26 12:00:00 UTC"
          },
          "fieldAinLink": {
            "uri": "http://www.flightsimexpo.com/"
          }
        },
        {
          "entityLabel": "Sun 'n Fun",
          "fieldAinEventLocation": "Lakeland, FL",
          "fieldAinEventDate": {
            "startDate": "2020-03-31 12:00:00 UTC",
            "endDate": "2020-04-05 12:00:00 UTC"
          },
          "fieldAinLink": {
            "uri": "https://www.flysnf.org/"
          }
        }
      ]
    }
  }
}

I tried adding this, to no avail:

{operator: GREATER_THAN_OR_EQUAL, field: "fieldAinEventDate.startDate", value: ["2021-07-25 12:00:00 UTC"]}


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.