You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cloudant connector has the problem, haven't checked other connectors:
When many-to-many relation has a through model, for example
Team hasMany Resource through TeamResource
Resource hasMany Team through TeamResource
Query a team with its resources included using Team.findById(teamId, {include: {relation: 'resources', scope: {limit: 100}}})
The connector first finds all the through model instances using teamId, then do a recursive find for each of the teamResources using its resourceId, and the limit filter is applied on it, which causes the problem.
As a workaround fix, PR #196 allows user to define a globalLimit to retrieve all the related model instances.
The real fix should:
compare with the other connectors see how they deal with include filter
investigate the possibility to find related model from through model in one query not a bunch of recursive queries, at least in the cloudant connector
if it's feasible to apply limit/skip/offset on the related model, create a PR for such a fix. If it's restricted by design, then document it and this workaround.
The text was updated successfully, but these errors were encountered:
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.
This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.
Description/Steps to reproduce
A follow up issue for strongloop/loopback#4006
Cloudant connector has the problem, haven't checked other connectors:
When many-to-many relation has a through model, for example
Team
hasManyResource
throughTeamResource
Resource
hasManyTeam
throughTeamResource
Query a
team
with its resourcesincluded
usingTeam.findById(teamId, {include: {relation: 'resources', scope: {limit: 100}}})
The connector first finds all the through model instances using
teamId
, then do a recursive find for each of theteamResources
using itsresourceId
, and thelimit
filter is applied on it, which causes the problem.As a workaround fix, PR #196 allows user to define a
globalLimit
to retrieve all the related model instances.The real fix should:
include
filterThe text was updated successfully, but these errors were encountered: