Skip to content

relations efficiency  #162

@wizardnet972

Description

@wizardnet972

In readme, How to build nesting/relations?, says that relations go like this:

UserTC.addRelation(
  'friends',
  {
    resolver: () => UserTC.getResolver('findByIds'),
    prepareArgs: { // resolver `findByIds` has `_ids` arg, let provide value to it
      _ids: (source) => source.friendsIds,
    },
    projection: { friendsIds: 1 }, // point fields in source object, which should be fetched from DB
  }
);

This is mean that graphql-compose-mongoose execute .find then for each property it's run .findByIds? instead of populate?

two or more calls instead one?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions