News for hackers. Stuff that matters.
Re:Learn GraphQL with GitHub by scottmf on Friday August 04, 2017 @09:26PM (#14933734)
Hmm, you're not quite thinking in GraphQL properly. That isn't how your schema should be designed.

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:

  Person {
    mother: Person
    femaleAncestors: [Person]
  }
Re:Learn GraphQL with GitHub by SirensOfTitan on Saturday August 05, 2017 @02:26AM (#14934474)
Yeah ideally ancestors would be a `connection`/`edge` with filters:

``` Person { ancestors(gender: Female, orderby: [AGE], first: 10) { node { name } } } ```

Re:Learn GraphQL with GitHub by scottmf on Saturday August 05, 2017 @01:21PM (#14936740)
Absolutely. Personally I haven't made much use of NoSQL, I'm sure there are plenty of use cases, but for ancestry I would still use a relational db.

I do see how nested objects might look like a perfect fit for this, since families are literally "nested objects". Perhaps there are plenty of advantages to using NoSQL and shaping the data this way... but the thought of creating an API With that structure is terrifying to me, haha.

Question to OP: are you using this structure for a live api/website I can take a look at? Does each node have an absolute ID? Do you normalize your data? Maybe I'm thinking too much in relational terms here? I'm genuinely curious about this.