MorphiaOrg / MorphiaOrg/morphia
Dynamic collection NamingStrategy
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.7k
- Forks
- 449
- Avg merge
- 7m
- Merged PRs (30d)
- 10
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading EntityModel.getCollectionName() and the NamingStrategy behavior described in the issue, then inspect the duplicate issue #2935 for context. The work is done when collection naming can respond to the current tenant at getCollectionName() time, or when the supported dynamic option and its expected behavior are defined and tested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, mongodb
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100