The project based on spring-data-mongodb use @indexed doesn't work when use the multi-tenant collections.The following is the code:
@Document(collection = "#{ @tenantProvider.getTenant()}activity")
@Data
public class Activity {
@Id
private String id;
@Indexed
private String activityId;
}
If the collection definition is dynamic you of course have to make sure you're creating indexes manually as there's no way for us to determine all possible collections that might be affected.
Users usually go ahead and create those indexes manually using
IndexOperations
.