Skip to content

Population with GraphQL? #6

@viztastic

Description

@viztastic

Hi @sayden

Great example! I am trying to see learn how to best model field Population using GraphQL.

I see that for your UserSchema mongoose schema you have the hobbies and friends fields both of which are ObjectIds and reference Hobby/Friend types respectively.

However in your GraphQL model, you don't seem to account for the possibility of the hobby and friend field taking on an ObjectId or HobbyType / UserType object.

I want users to be able to receive a list of ObjectIds or populated objects depending on their query params.

How would you best do this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions