Good approach regarding many to many relationship

Hi Bubblers,

I have searched many hours for the best solution for the current data model i’m trying to build and i’m still a little unsure as to what the best approach would be.

So imagine the following data types and fields:

  • Contact: FirstName, LastName and Status (Active or Deleted)
  • Company: Name and Status (Active or Deleted)
  • Contact_Company: Contact, Company, Function (for example “project manager”)

Then there is a page called “Contact Details” where i get the contact data by contactId and display firstname and lastname in textfields. It also has a repeating group which should load related companies which are active (Status = Active). For performance i followed advise that i found on this forum to not use Lists (a list of Contact_Company on data type Contact for example) and use a “Search for Contact_Company” filtered on the loaded contact of the page instead.

Example (fake data):

The query to fetch related Contact_Company:

image

This seems to load slower than if i use Lists, what could be the cause of this? Free plan, not enough data, maybe the query is wrong, maybe something else…

Also, i’m not able to filter the deleted Companies (filter on Status). Should i include “Company Status” and “Contact Status” on the datatype “Contact_Company”?

Any advise would be greatly appreciated.
Let me know if my question is unclear of more information is needed.

Storing a list of Contact_Company under the Contact would be way faster than doing a search. Bubble has to search through every single entry then show the filtered results at the end (slow) vs. just displaying the list stored under the contact in question (fast).

Maybe people were talking about it being slow because whenever you look at the contact it also has to pull up every Contact_Company, but in your case you probably always want that anyways?

When your data source is the list of Contact_Companys, do :filtered, and add a new constraint Advanced: (all the way at the bottom of your choices) then making the filter “This Contact_Company’s Company’s Status is Active”

1 Like

Thanks tyler!

1 Like