loopback icon indicating copy to clipboard operation
loopback copied to clipboard

Querying associated model exists or not

Open fanttm opened this issue 9 years ago • 3 comments

I have read #1744, I know that

m1.m2s({
  include: [
    {
      relation: 'm3s',
      scope: {
        where: {
          someCondition: something
        }
      }
    }
  ]
})

This returns all m2s and includes m3s with matching condition which is perfect. And maybe some m2s has no m3s.

Then I want to get m2s that has at least 1 m3s, How can I do about it?

fanttm avatar May 16 '17 02:05 fanttm

@fanttm

It is not currently supported in loopback, you can use native query if you want.

padelagani avatar May 16 '17 05:05 padelagani

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.

stale[bot] avatar Aug 23 '17 14:08 stale[bot]

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.

stale[bot] avatar Sep 06 '17 17:09 stale[bot]