[SERVER-34841] Cannot create multiple indexes with the same pattern but different options Created: 04/May/18 Updated: 10/May/18 Resolved: 04/May/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Index Maintenance |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Ralf Kistner | Assignee: | Ramon Fernandez Marina |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Operating System: | ALL | ||||||||
| Participants: | |||||||||
| Description |
|
Background: In our production system, we have an unique index, that used the wrong partialFilterExpression. This caused the query planner to not use this index when querying for documents. To fix this issue, we want to create the correct index, and only drop the previous index afterwards, to ensure we still have consistency. However, MongoDB prevents us from creating another index with the same pattern:
Our only solution currently is to first drop the old index, then create the new one. However, this results in a period of time where the unique constraint is not enforced, which can potentially cause issues. This may be a duplicate of https://jira.mongodb.org/browse/SERVER-22194, but that issue had a different use case, and was closed as a duplicated of a different issue.
|
| Comments |
| Comment by Asya Kamsky [ 10/May/18 ] |
|
For future reference, there is an ugly work-around that does not leave you with no constraint and that is to add a new index with an extra trailing field (a dummy field that's not set in any documents) then drop original index, recreate the new index and then drop the temporary index.
|
| Comment by Ramon Fernandez Marina [ 04/May/18 ] |
|
Thanks for your report ralf@embarkmobile.com, this one is a duplicate of a different ticket, Regards, |