We are in the process of designing a multi-tenant application. During my research, I found out there are a few approaches that we can follow.
- Database per tenant
- Collection per tenant
- Everything in one database and no collection separation, use a field to separate
I believe Approach 3 would not work for us since this application needs to scale to 1000s or 10,000s of tenants.
I want to know
A) what are the limitations and advantages of approaches 1 or 2? are there any performance limitations or cost-wise issues in each approach?
B) what is the most recommended practice. we are planning on using MongoDB atlas and everything needs to be handled programmatically.
C) how we can limit access control in each approach, however this also needs to be done programmatically.