Need Help Understanding the DB, so that I can create a fairly "simple" structure

Hello everyone. I’m trying to wrap my head around Bubble’s Database and data structures, and the correct ways of working with it.

In the Database I created a WeeklyMenu “type.” It has several fields that represent Dishes on particular days, and Dishes are “objects” containing 4 fields (strings) that represent separate ingredients.

I understand that I can create ANOTHER type for the Dish and then reference them but…

  1. Do I always have to create a separate Type in the DB for this Dish object, which then creates a “thing” in the DB for each dish?

  2. Is this the “right” way to work with Bubble’s DB, even if I would NOT be quering Dishes separate from the WeeklyMenu??? And previous-made dishes would have no relevance in the future.

  3. What feels “off” to me is having a whole Dishes table in the DB that won’t really be used except as references to “objects” that I much rather just have within WeeklyMenu (if possible). And that, if I were to delete WeeklyMenus I would also have to retroactively delete the referenced Dishes to keep the DB “clean.”

In the No SQL databases that I have experience with, I would just drop in the JS object/map on the WeeklyMenu and call it a day, but I’m not sure what’s the correct way of doing the same in within Bubble’s DB.

Thanks for any and all help.
You’re the best.

If no dish ever repeats – in other words each dish is unique to the WeeklyMenu, then yes you could just drop the information into your WeeklyMenu datatype – for example having a text field in WeeklyMenu and then just listing the dishes and their ingredients in that text field.

But if you ever want to sort/search Dishes, or classify them (so that you could search weekly menus for types of dishes), or do calculations (how many dishes of each type are being served) or have Dishes that you can re-use for different WeeklyMenus, then you should break it out as a separate Datatype.

Likewise if the Ingredients of the Dishes were something that you wanted to manipulate, you could break those out into a separate Datatype.

It all comes down to the purpose of the app and what you need to do with it.

1 Like

Thank you so much for your response!

With this new perspective I realized a new way I can achieve what I needed. And I’m much clearer on what I would want to do with the DB. The dishes will certainly be unique a “disposable” in that matter, so I will go with the string a approach since, in the end, that’s what I wanted the dishes for, to compile them into a string.

Cheers!

1 Like

If you have a relatively small or limited number of dishes (and your users won’t be creating dishes) you could possibly use an option set.

1 Like

Thanks. In this case, dishes are always changing, but I do use Option Sets for a bunch of other things, they are super useful.