I’ve read every link on google I can about mongodb and multi tenancy. I’m several months into development of a new product and I’m currently using Postgres/Nodejs/Feathersjs. Some of our customers requirements is really making me question Postgres as they want a lot of custom fields, revision history, etc that seems like Mongo would be much less complex.
The biggest issue holding me back at this point is multi tenancy. At least one of our customers will need data isolation, so developing this in mongo with 1 database per tenant is the only thing that makes sense (ruling out shared database with tenantID in every document). Separate DB’s however doesn’t seem as easy as Postgres’s schemas for isolating tenant data. With Postgres, the connection pool can all be the same and per request you can specify the schema to use (using knex.withSchema(tenantId)). Looking at mongoose documentation there is the useDB() function, but that’s actually just opening a new connection? Is there any performance concerns with that? We plan to have many tenants, with 10-30 users each (no freemium model) so I worry that connections would need to be constantly being opened and closed.
I’m curious, is there any planned support for something like postgres’s schemas eventually? With all the questions about multi tenancy it seems like it would be a very used feature.