|
|
|
|
|
by jbjorge
3234 days ago
|
|
I probably was a bit unclear.
Lets say I've got a family tree stored in a db that goes back 1000 years. Through graphql I want to find my first ancestor following all mothers backwards. The query would be: query familyTree {
name,
mother {
name,
mother {
..and so on for an unknown number of nestings
}
}
}
Dataloader solves batching of the nested query on the server, but doesn't solve the problem of not knowing what the correct number of nestings the query should have.Of course it's possible to create a new graphql endpoint for this type of query, but then we've just recreated REST in graphql. |
|
Your mother field should resolve to a Person type, with a mother and/or ancestors field, which would be a graphql list type of the Person type.
Something like this: