Skip to content

Specify collection name without using of @Document [DATAMONGO-2525] #3380

Open
@spring-projects-issues

Description

@spring-projects-issues

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

Metadata

Metadata

Labels

in: mappingMapping and conversion infrastructuretype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions