Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DATAMONGO-2188 - Deprecate auto-index creation. #636

Closed
wants to merge 5 commits into from

Conversation

mp911de
Copy link
Member

@mp911de mp911de commented Jan 16, 2019

We now deprecate the auto-index creation feature as automatic index creation has created a lot of downstream issues.

We also introduce a configuration flag to disable auto-index creation through MongoMappingContext.setAutoIndexCreation(false).

Lastly, we're exposing IndexResolver to allow application code to derive index definitions from annotated entities.


Related ticket: DATAMONGO-2188.

Auto-index creation can now be disabled by setting MongoMappingContext.setAutoIndexCreation(false). This configuration prevents automatic index creation on application startup and during access to entities.

Auto-index creation comes with automated collection creation. Users that rely on collection creation (e.g. if you wish to use ClientSessions or transactions) must make sure the collection exists prior to session usage.
We now provide IndexResolver to resolve and derive index definitions from Mongo entities.

MongoMappingContext mappingContext = new MongoMappingContext();
IndexResolver indexResolver = IndexResolver.create(mappingContext);
Iterable<? extends IndexDefinitionHolder> definitions = indexResolver.resolveIndexFor(MyEntity.class);
@christophstrobl christophstrobl force-pushed the issue/DATAMONGO-2188 branch 2 times, most recently from 789642e to 46cda36 Compare January 22, 2019 11:02
Undo deprecation and transition to configuration option allowing to disable the index creation. Index creation will remain in the codebase as it is used in a lot of places to configure required geo index structures in MongoDB without which query execution would fail.
christophstrobl pushed a commit that referenced this pull request Jan 23, 2019
…ion to disable it.

Auto-index creation can now be disabled by setting MongoMappingContext.setAutoIndexCreation(false). This configuration prevents automatic index creation on application startup and during access to entities.

Original Pull Request: #636
christophstrobl pushed a commit that referenced this pull request Jan 23, 2019
We now provide IndexResolver to resolve and derive index definitions from Mongo entities.

MongoMappingContext mappingContext = new MongoMappingContext();
IndexResolver indexResolver = IndexResolver.create(mappingContext);
Iterable<? extends IndexDefinitionHolder> definitions = indexResolver.resolveIndexFor(MyEntity.class);

Original Pull Request: #636
christophstrobl added a commit that referenced this pull request Jan 23, 2019
Undo deprecation and transition to configuration option allowing to disable the index creation. Index creation will remain in the codebase as it is used in a lot of places to configure required geo index structures in MongoDB without which query execution would fail.

Original Pull Request: #636
@christophstrobl christophstrobl deleted the issue/DATAMONGO-2188 branch January 23, 2019 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants