Closed tomprogers closed 4 years ago
include never worked like that, it was/is a boolean option that tried to predict what kind of relations you would want based on the subfields in the query.
You can add includes manually in the before hook if you absolutely need to (if it's a 1:M you almost always use for instance), but otherwise stick to using dataloader logic, the performance is more linear and predictable than includes are.
How to use dataloader logic?
I got this mutation where I need the organisation of the user. How to load it. Why isn't it lazy loaded when I call the user.organisation property?
Part of user.mutation.ts:
forgetPassword: resolver(User, { include: [Organisation],
before: async (findOptions, { email }) => {
findOptions.where = { email };
return findOptions;
}, [..]
Part of user.model.ts
@BelongsTo(() => Organisation)
organisation: Organisation;
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I want to do this:
But
include
is now disallowed. What's the workaround?Related stackoverflow.