'Multi tenant in Firestore
Looking to build a CRM type application and need to separate the data for each client in the firestore database.
Whats the best way to structure the data?
If we take a few basic collections for this example... company
, user
, account
, product
.
- A user is simply the user of the application i'm building.
- This
user
would work for acompany
that employs them. - The
user
would then look to sellproduct
s toaccount
s.
Generally to handle this should I be placing
company
at the root level.- Then
user
,account
andproduct
underneathcompany
.
Im unsure whats best security wise and/or normal convention.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|