Open agnes512 opened 4 years ago
This issue has been marked stale because it has not seen activity within six months. 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. This issue will be closed within 30 days of being stale.
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.
Is there any update about this issue ?
No updates at the moment.
hey All,
we are doing a research using TypeORM and loopback 4 but there are a couple of issues on models. Eg how to setup relations manyToOne.
Do you have any ideo how to hooks repositories to avoid to use N+1 query? there are too many connection to the database. lb3 https://loopback.io/doc/en/lb3/Nested-queries.html
Maybe use include as another ORM could help to avoid and scale more application.
A quick solution for us is use custom query but I am not sure if that could be the best solution. Also, we are going to use elastic search in our API.
My second approach is create a handler in all my request and make queries then map that result in the repositories.
Suggestion
Original from comment.
LoopBack 4 provides the custom scope to achieve inclusion, which was implemented in #3454. But it only goes down to the certain levels of relations that are described in the filter, for example, three levels:
It'd be good to have a better way to query nested relations to max depth/ N degrees, something like
{relation: "nested", depth: 10}
.Examples
Model
Comment
has manyreplies: Comment[]
, and comments in thereplies
has manyreplies
, etc. Returns when there is no more replies or the max depth is reached.Acceptance criteria