I’ve been looking at the prices of mongodb atlas and I was left with a doubt. Are there any limitations on the number of databases I can have? I ask this because my plan is to have a bank (database) for each user of my solution and not use a bank for everyone.
If you have a dedicated cluster (M10+) there is no limit on the number of databases or collections you can have. If you have a free (M0) or shared tier cluster (M2, M5) there is currently a limit of 100 databases and 500 collections total.
I would consider how you plan to model application users versus database users. Typically end users of your application should access data via your application or API, and would not have direct access to the database. There is a limit of 100 database users per Atlas project.
For more information, see:
This is exactly the idea. The reason is, not to mix data from multiple customers in the same database, for security reasons. But customers would only have access to the data through the application or api.
The user who will connect to the database will always be the same for all customers, however, the application will access different databases depending on the user who logged into the application. That is:
User “Foo” logged in, application connects to the “Foo” database.
“Bar” user logged in, application connects to the “Bar” database.
User “Qux” created an account, application creates the database “Qux”.
It is worth mentioning that it is a SaaS for corporations, therefore it will not have such a large number of customers. The expectation would be 150 to 200 customers.
@Matheus_Saraiva did this ended up working fine at the end? Any pitfalls?
One pitfall to avoid is Massive Number of Collections