0

I create Firestore multi-user inventory management. My question is about best structure for it. I think about 3 options:

  1. flat options - only products

    products
      -product1
      -product2
        -user
        -product-name
        -category
        -subcategory
    

    If I have 100 users and every one has 1000 product in inventory it will cost me plenty "reads".

  2. users separately

    users
      -user1
      -user2
        -products
          product1
          product2
           -product-name
           -category
           -subcategory
    

    In this case there is plenty "reads" but only around "user"

  3. deep to subcategories

    users
      -user1
        -categories
          -category1
            -subcategories
              subcategory1
               -product-name
    

    Thia option is to deep for me but it saves "reads"

How would you do it?

awariat
  • 331
  • 1
  • 5
  • 22
  • [There is no "perfect", "the best" or "the correct" solution for structuring a Cloud Firestore database.](https://stackoverflow.com/questions/53053768/what-is-the-correct-way-to-structure-this-kind-of-data-in-firestore/53057707). That being said, tell us please, what are the queries that you intend to perform. – Alex Mamo May 16 '19 at 09:35
  • OK so maybe another way: if I use "where" is checks every document and charges for every document? – awariat May 17 '19 at 09:24

0 Answers0