Forum Academy Marketplace Showcase Pricing Features

Confused about basic database relationships

I’m trying to understand how a two-way relationship between databases works.

I have two databases: Retailer and Deal
A deal belongs to a retailer, but a retailer could have many deals.

Here’s how I set up my database:

In my workflow, I’m creating a new “Deal” and allocated all the fields to the Deal database.

After submitting a few samples forms, I noticed that the Retailer’s name is successfully added to the Deal database. Given the two-way relationship that I setup I expected the deal to also be added to the list of deals in the Retailer database but that has not happened.

Am I missing something? Should I add something in my workflow?

Thanks in advance

I would recommend not making a List of Deals. Actually, I hardly ever use List of anything in my database relationships. Why? Because @petter said so. :wink:

The way that Bubble loads data, if you ever load a list of Retailers, it will also load a list of Deals for each and everyone of them. It might be fine to start out, but it will quickly give you troubles later on. Besides, I went down this route before trying to create a “graph” database and boy! did I waste time hunting down bugs and improving workflows when I could have simply avoided it.

1 Like

From my understanding, it is not loading all the data related to them, but instead is loading all of the unique ids, which as a string of text each character adds 1 bit of data, so a 34 character unique id would be 34 bits of data and if on that list you had a few hundred items it could add up.

Also, lists of things generally perform worst once it goes beyond 50 items or so comparative to a search of that data type with a single constraint. Plus the upper limit of no more than 10K max on a list.

Because of this, like you, I hardly use list of things for relationships.

@Ayjey In the Deals data type just keep that Retailer field and on the retailer remove the list of deals…you can easily search for the Deals and constrain by the Retailer to show the retailer all deals they are a part of. For the Other user in the Deal I would assume you will be referring to the Creator built-in field for that relationship.