spring-projects / spring-projects/spring-data-mongodb
Indexed affects not only root collection [DATAMONGO-1965]
@odrotbohm is already working on this.
Since Dec 30, 2020.
- #4600 by @rolag-it — closed without merging
- Dominant language
- Java
- Stars
- 1.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
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
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.