Announcement Announcement Module
Collapse
No announcement yet.
How to do multi tenant spring data mongodb? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to do multi tenant spring data mongodb?

    I am starting a MULTI-TENANT project in spring data mongodb.

    How can I achieve collection-per-tenant approach in Spring Data Mongo? Apparently, There's no out-of-box solution provided, but I thought I could tweak MongoTemplate by overriding determineCollectionName method but I assume its not a public nor protected method for purpose.

    However, I set up database per tenant approach very easily by extending SimpleMongoDbFactory and using LocalThread.

    So, the questions are:
    1. Is there any safe way I can override the collection and domain class name mappings? p.s: This should happen at runtime, so I think @collection annotation won't help at all.
    2. If the collection per tenant is impossible, how much performance and resource penalties will I get for taking multi db approach?
Working...
X