neo4j-graphql-java
neo4j-graphql-java copied to clipboard
Filter and Limit is not working on Child Nodes
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.
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
}
}
}
}