marija
marija

Reputation: 63

Filtering nested properties in subgraph (the graph)

Is it possible to filter subgraph using "where" when properties are nested?

For example if we have query like this one, can we filter it by application name?

{
  challenges(where: {something?}) {
    challenger
    outcome
    application {
      id
      name
    }
  }
}

I have tried it like this one but it doesn't work

{
  challenges(where: {application: {name: "something"}) {
    challenger
    outcome
    application {
      id
      name
    }
  }
}

Upvotes: 4

Views: 2588

Answers (2)

nezort11
nezort11

Reputation: 633

You can write:

{
  challenges(where: {application_: {name: "something"}) {
    challenger
    outcome
    application {
      id
      name
    }
  }
}

Notice _ after the property name

Docs: https://thegraph.com/docs/en/querying/graphql-api/#example-for-nested-entity-filtering

Upvotes: 7

jjperezaguinaga
jjperezaguinaga

Reputation: 2482

Unfortunately, The Graph does not currently support nested queries. They currently have it on the roadmap, so my recommendation is to subscribe to their releases in their repository or check their #announcements channel in Discord.

Upvotes: 1

Related Questions