Collection based multitenancy with Spring Data MongoDB
问题 Our Spring Boot 1.3.3 application persists data on MongoDB (2.6 ou 3.2) using Spring Data MongoDB 1.8.4. We need to support multitenancy. We chose to use "collection based" multitenancy, i.e. each tenant has its own set of collection. For example for the Article entity, the collections are "{tenantName}_articles". Oliver Gierke kindly explained an implementation in Making spring-data-mongodb multi-tenant using for example : @Document(collectionName = "#{tenantProvider.getTenantId()}_articles"