Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter and Limit is not working on Child Nodes #277

Open
Eddy08 opened this issue Sep 7, 2022 · 1 comment
Open

Filter and Limit is not working on Child Nodes #277

Eddy08 opened this issue Sep 7, 2022 · 1 comment

Comments

@Eddy08
Copy link

Eddy08 commented Sep 7, 2022

GraphQL schema

type Parent{
     parent_id: String
     parent_name: String
    Parent_Child_Mapping:[Parent_Child_Mapping]
}
type Parent_Child_Mapping @relation (name: "Parent_Child_Mapping", from :"Parent", to: "Child"){
     Parent: Parent
    Child: Child
    edgeDetails: String
}
type Child{
     child_id: String
     Parent_Child_Mapping: [Parent_Child_Mapping]
}

GraphQL request

query:
           Parent(first:2) { 
                                        parent_id
                                       Parent_Child_Mapping(first:2){
                                                edgeDetails
                                                Child(first:2){
                                                   child_id
                                                  }
                                         }
                             }

Expected GraphQL response

Error :Missing Field:Validation error of type UnknownArgument:Unknown field argument firs @ 'Parent/Parent_Child_Mapping/Child'

Additional context
In My Current Data there are multiple relationships between two nodes i.e One Parent Node with Multiple Parent_Child_Mapping with One Child Node.
Limit and Filter should work on the Child Node but working only on Parent and Parent_Child_Mapping.

@AakashSorathiya
Copy link
Contributor

Hi @Eddy08, this is the expected behavior. In type Parent_Child_Mapping you have defined Parent and Child as singleton attributes so filter, first and offset arguments will not work because according to graphql-spec these arguments can be applied on List attributes. In this case if you want to apply filters on child node you can write your graphql as below

{ 
  Parent(first:2) { 
    parent_id
    Parent_Child_Mapping(first:2, filter: {Child: {child_id: "id-filter"}}) {
      edgeDetails
      Child {
        child_id
      }
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants