Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Filtering on the basis of child entities #2960

@azf20

Description

@azf20

Subgraph consumers can currently only filter and sort on the basis of top-level entity fields. As a consumer, I want to be able to filter and sort on the basis of child entity fields.

Schema:

type Author @entity {
  id: ID!
  genre: Genre
  userProfile: User @derived(field: "id")
}

type User @entity {
  id: ID!
  dateOfBirth: String
  country: String
}

Query:

query {
  authors(where: {userProfile: { dateOfBirth_eq: "1987-04-03" } }) {
    id
  }
}
  • Will there need to be a limit on how many layers deep a filter can be applied? Restrict at one level, at least to begin with
  • Are there any considerations around arrays of child entities, vs. single child entities?
  • How will this work with interfaces?
  • Will there be a conflict between userProfile: "12345" and the nested filter? Will need to be a union of a String and an object, or make a breaking change

Meta-task: compare with syntax from other projects

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions