spring-projects / spring-data-mongodb

Provides support to increase developer productivity in Java when using MongoDB. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.
https://spring.io/projects/spring-data-mongodb/
Apache License 2.0
1.62k stars 1.09k forks source link

MultiDatabase Auto Index #4488

Open Lucasark opened 1 year ago

Lucasark commented 1 year ago

From this issue:

issue

Now with reproduction:

https://github.com/Lucasark/mongodb-multidata

Behavior:

image

Expected: Create index only on collection "NewDB1" of model_1, but it created on both collections

christophstrobl commented 1 year ago

Thank you for following up on that issue - we'll have a look.

Lucasark commented 1 year ago

Thank you for following up on that issue - we'll have a look.

Any update?

Lucasark commented 1 year ago

@christophstrobl any update?

christophstrobl commented 1 year ago

it's on the list - sorry it takes so long.

Lucasark commented 1 year ago

it's on the list - sorry it takes so long.

Just to remember haha, :D

christophstrobl commented 1 year ago

It looks like the sample is sharing the very same MappingContext having index creation enabled for the two templates. Since the context is auto configured the entity scanning picks up all domain types from the applications base package com.example.multi_mongo_proj which contains both modelRepo1 and modelRepo2 .