While trying to design a database structure for a SaaS application i have got a different ways to do it. However i am curious to know which approach is the best with MongoDB Atlas.
We expecting to have close to 500 tenants. Coming to the behavior of tenants:
- We expect same Schema across all tenants with no customization
- We expect more or less equal load across all tenants
- Based on the application, we expect 50 -80 collections within each tenant
Now when we design the DB we have come across multiple approaches, however based on the no. of tenants, what should be the right approach.
- One database per tenant.
a. With this approach is there a limitation with no. of databases that can added to a cluster?
- One database for all tenants where tenant specific data is identified by tenant id with each collection
a. How will performance impact when 2500 users use the application?
- One database for all tenants and Shard data based tenant id
Can you please share your thoughts if you have come across with similar use cases ?