Skip to content

Indexed affects not only root collection [DATAMONGO-1965] #2836

Open
@spring-projects-issues

Description

@spring-projects-issues

Vadzim Parafianiuk opened DATAMONGO-1965 and commented

If I use @Indexed in one class, I want spring to create Index only in collection for this class, but it also creates index in another classes that use this @Indexed class as embedded field. As a result, if I use "unique = true" it also affects embedded fields in another classes. See my question on stackoverflow with more rich description and example.

 

I've found a solution: I create ApplicationListener, and after context loading I use MongoTemplate to create indexes manually. But it is not convenient


Reference URL: https://stackoverflow.com/questions/49930576/spring-data-mongodb-indexedunique-true-in-inner-field

Metadata

Metadata

Assignees

Labels

for: team-attentionAn issue we need to discuss as a team to make progresstype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions