spring-projects / spring-projects/spring-data-mongodb
Specify collection name without using of @Document [DATAMONGO-2525]
@christophstrobl is already working on this.
Since Dec 30, 2020.
- Dominant language
- Java
- Stars
- 1.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Vladislav Ogol opened DATAMONGO-2525 and commented
I as a developer want to have an ability to manage collection names without specifying
@Document annotations, so that it will let me persist objects which are out of my control or which should not be coupled with persistent layer implementation in a custom named collections.
I think that the easiest way to do that is to let me provide own implementation of the MongoCollectionUtils class (probably with some more suitable class name) with the static method getPreferredCollectionName replaced with something like this:
public Supplier<String> getPreferredCollectionName(Class<?> entityClass) {
return () -> StringUtils.uncapitalize(entityClass.getSimpleName());
}
So that the Supplier can be cached in MongoPersistentEntity for future use
Affects: 2.2.6 (Moore SR6)
1 votes, 2 watchers
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.
Assessment
This issue has not been assessed yet.