0

I'm building a blog API using the Loopback 4 framework and I didn't find in documentation or any article on the internet for how to do many to many relationships (Posts and Categories)

So my question is: How to do such a relation in LoopBack 4? and If not supported is there a workaround!

Also, another question, how to do a cascade ( update, insert ) and update on duplication using LoopBack 4?

3
  • I found your missing docs: loopback.io/doc/en/lb4/HasMany-relation.html :) Commented Apr 13, 2020 at 17:08
  • This is a one to many relations!!!! many to many is not on the loopback documentations Commented Apr 13, 2020 at 19:52
  • please recheck the link and read what inside Commented Apr 13, 2020 at 19:52

1 Answer 1

2

LoopBack 4 doesn't currently support hasAndBelongsToMany relation. You'll need to create your own junction table/Model using a hasManyThrough relation.

See the relevant GitHub issue: https://github.com/strongloop/loopback-next/issues/2308

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.