hesham shawky
hesham shawky

Reputation: 1151

NodeJS: How to do a many to many relation using Loopback4

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?

Upvotes: 0

Views: 250

Answers (1)

Rifa Achrinza
Rifa Achrinza

Reputation: 1585

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

Upvotes: 2

Related Questions