Help with reverse addon in many-to-many relationship

Hello,

I have two tables, Users and Groups, and Users has a table ref to Groups (Groups is not ref'd back to Users). This is a many to many relationship.

When running the Query All /Groups endpoint, I'm hoping to only returns groups in which the authenticated user is a member. Based on the Database - Part 3 video, it seems like using a reverse addon is the way to go here, but I'm a database newb and am really struggling.

The first thing I'm a littly shakey on is the fact that i'm not getting the virtual table that's an array of user.group_ids with which I could do an inner join. In the screenshot of the Database video, it looks like it's because he's querying jobs which have reference to location already. In my case, I don't. My groups do not have a reference to users.

So then I'm thinking, can I do an inner join without specifying an input. This doesn't error out but it returns all groups.

So then I'm wondering how I can limit the join to just group_ids of authenticated user. And, if I add a second join, I get that virtual table of user.group_ids that looks like the one in the video.

I'm sure I'm way over complicating this but have spent a few hours looking around in the community and doing good old trial and error and would appreciate any guidance.

1 reply