morphia icon indicating copy to clipboard operation
morphia copied to clipboard

Dynamic collection NamingStrategy

Open github-actions[bot] opened this issue 4 months ago • 0 comments

Duplicate of #2935 for milestone 3.0.0


Is your feature request related to a problem? Please describe. We use different collections based on the tenant. Previously (v1.x) it was possible to override the getCollectionName method in the Mapper. We would like to be able to use a dynamic NamingStrategy based on the current tenant. However, the current NamingStrategy sets the collectionName in the EntityModel on load and it cannot be changed after that.

Describe the solution you'd like The NamingStrategy should be called when the getCollectionName() method is called on the EntityModel. Or at least, there should be an option to make it dynamic, so that it's called on getCollectionName().

Describe alternatives you've considered Can't see any alternative options at the moment.

github-actions[bot] avatar Aug 28 '25 02:08 github-actions[bot]