Closed bajtos closed 5 years ago
Hi @bajtos
this._registerHasManyInclusion('todos', todoRepositoryGetter);
When I add this code I got the error "_registerHasManyInclusion" it's not defined. Please provide the full function for this _registerHasManyInclusion
@AnanthGopal this is a spike. The feature is still being worked on and is not implemented or released yet.
MVP scope
resolve{Relation}Metadata
#3440keyFrom
to resolved relation metadata #3441findByForeignKeys
helper (initial version) #3443inq
splitting in findByForeignKeys
#3444InclusionResolver
concept #3445DefaultCrudRepository
#3446todo-list
example to use inclusion resolver #3450lb4 relation
CLI #3451Post-MVP
Continue the works started in #2124, leverage the building blocks implemented as an outcome of #2592 and create a detailed proposal for implementing resolver for navigational properties.
Implementation wise, I think we want to end up with the following user experience:
The question is how to implement
_register**Inclusion
APIs and process the registered inclusion handlers infind
/findById
implementations provided byDefaultCrudRepository
. See https://github.com/strongloop/loopback-next/issues/1352#issuecomment-436197152 for more details on that.It is important to consider the scenario where we want to fetch multiple source models and include their related models in the result, e.g.
TodoList.find(1, {include: [{relation: 'todos'}]})
. Under the hood, we must avoid SELECT N+1 issue. Inclusion handler must be able to fetch related models for multiple source-model ids in one query (usinginq
operator under the hood). The design proposed in https://github.com/strongloop/loopback-next/issues/1352#issuecomment-436197152 is already taking that into account, so does the existing implementation in juggler.Acceptance criteria
examples/todo-list
to show the proposed user experiencepackages/repository
/_SPIKE_.md
) describing the proposal at a high level. Keeping the document in git (instead in GH comments) makes it easier to discuss individual parts of the proposal and keep the proposal versioned.lb4 repository
to generate calls ofthis._registerHasManyInclusion
and friends.