Carlos R
·I'm passionate about simplifying life!

Stuck at database setup

Database & APIs

Hi everyone,

I would appreciate your guidance on how to set up my database properly. I'm stuck and cannot figure out/understand how to set it up with FF.

Here's the information:

  • There's a directory of businesses

    • Each business has 4 products.

      • For example: Product A, Product B, Product C and Product D.

    • The number of products per business is set. They all have the same products.

    • Each business has a list of items for each product.

      • For example: For Business XYZ, Product A has 4 items. Product B has 6 items. Product C has 3 items. Product D has 7 items.

    • The number of items per product is unique and can vary per business.

      • For example: For Business ABC, Product A has 7 items. Product B has 2 items. Product C has 6 items. Product D has 0 items.

  • Users can select their favourite businesses, so each user will have a list of favourite businesses.

    • Within their list of favourite businesses, users can select which item, for each product, is their favourite. They can only select one item per product per business as their favourite.

      • For example: For Business XYZ, Product A, the user select item 1 as their favourite. Product B, the user selects item 4 as their favourite. Product C, the user selects item 2 as their favourite. Product D, the user selects item 6 as their favourite.

        • And for Business ABC, Product A, the user select item 4 as their favourite. Product B, the user selects item 1 as their favourite. Product C, the user selects item 5 as their favourite. Product D, the user does select any because there are no items to choose from.

I cannot for the life of me set up the FF database properly.

I come from the school of relational databases: one to many, many to many, many to one. That's clearly not the way FF's database is set up and cannot figure it out.

Any help and guidance would be greatly appreciated. 🙏

What have you tried so far?

I've checked the documentation and a few Youtube videos, and it seems it has not been enough to rap my head around how FF database works.

Currently, I have set up each product as a collection. So each document in that collection is an item under that product. Within each product collection, I created a variable that is a Doc Reference to the business. So each item in that product will have a Doc Reference to the business.

But that's not working. When I create a list of businesses, I cannot show on the list the items. I can only get the Document ID, but not any other information from the item, like name, image, etc.

Did you check FlutterFlow's Documentation for this topic?
Yes
2
11 replies