Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursive inclusion of related models #3454

Open
bajtos opened this issue Jul 26, 2019 · 4 comments

Comments

@bajtos
Copy link
Member

@bajtos bajtos commented Jul 26, 2019

In LB3, it's possible to recursively include models related to included models. Let's implement that feature in LB4 too.

For example, consider the domain model where Author has many Post instances and each Post instance has many Comment instances.

Users can fetch authors with posts and comments using the following query:

userRepo.find({
  include: [
    {
      relation: 'posts',
      scope: {
        include: [{relation: 'comments'}],
      },
    },
  ],
});

LB3 also offer few simpler alternatives how to express the same query:

userRepo.find({include: {posts: 'comments'}});
userRepo.find({include: {posts: {relation: 'comments'}}});

LB3 test suite:
loopback-datasource-juggler/test/include.test.js#L175-L195

See also #3387

Acceptance criteria

TBD - will be filled by the team.

@st119848

This comment has been minimized.

Copy link

@st119848 st119848 commented Oct 20, 2019

waiting for this feature

@eyasalmamoun

This comment has been minimized.

Copy link

@eyasalmamoun eyasalmamoun commented Oct 30, 2019

Plus one

@upscreen

This comment has been minimized.

Copy link

@upscreen upscreen commented Nov 6, 2019

let me know if we can contribute

@marioestradarosa

This comment has been minimized.

Copy link
Contributor

@marioestradarosa marioestradarosa commented Nov 7, 2019

@upscreen , it would be nice to have your contribution.

See our Contributing guide and Submitting a pull request to LoopBack 4 to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.