How to retrieve only the entries that are related in another content type?

Hi all, I’m using the Javascript client and I need some help here.

So I have two content types:

  • brand
  • technology

The technology model has a “many relationship” field pointing to a one or more brand.

I want to get only the brands that have technology content related to it.

I’m trying to do the listing page for the technology content, and add a filter based the available brands, but I want only to show the brands that are actually related to a technology, so there’s no point of showing all the brands to filter from if there’s going to be no content to show.

So I cannot find the way to list only the brands that has been linked on the technology type because there is no way to filter them by any field or anything.

I only see two options to do this:

  1. Create a reference field in brand content type that references many technology content types, but this would require to be manually editing both types anytime they are modified, or maybe create a webhook to update this field automatically, and this require an external endpoint that for whatever reason could fail. Too much complexity for something as simple as an exists clause.

  2. Get all the technologies, retrieve all the duplicate brands arrays, convert them to a set to delete duplicates, then convert it again to an array.

There’s also the possibility to leave all the brands listed as possible filters, and show a “no results found”.

Any other idea on a solution to this?

Thanks