marshallswain / feathers-graph-populate

Add lightning fast, GraphQL-like populates to your FeathersJS API

Home Page:https://feathers-graph-populate.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to handle n:m relationship

jontacky opened this issue · comments

Hi, Thanks for this wonderful library,

What is the best way to handle a many-to-many relationship with this library?

Thanks

It depends on your database tech, really.

If you're using MongoDB or Postgres with JSON columns, you'll be able to directly query from one array column to another array column.

If you're using a join table, you'll need to treat the join table as its own entity so that feathers can make queries against it. In this case, two queries will be made: one for the local table to the join table and another for the join table to the foreign table.