[SERVER-13290] createIndex on existing index but different name should return error Created: 19/Mar/14 Updated: 06/Dec/22 Resolved: 05/Jul/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Index Maintenance |
| Affects Version/s: | 2.6.0-rc1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Kay Kim (Inactive) | Assignee: | Backlog - Query Team (Inactive) |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | query-44-grooming | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Query
|
||||||||
| Operating System: | ALL | ||||||||
| Participants: | |||||||||
| Description |
|
For the most part, ensureIndex on an existing index but with different options error, but if the only difference is the name, it doesn't error.
Given that the check seems to be by name, I can see that if the names differ, then of course, it won't do the check but wasn't sure. If this is the expected behavior, I can just simply state that if an index already exists with the same name, ensureIndex will error if the key specs or the options differ. instead of having two separate error cases of (same key spec, different options) = error and (different key spec, same name) = error |
| Comments |
| Comment by David Storch [ 05/Jul/19 ] | |||||||||||||||||||||||||
|
It looks like this has been fixed under | |||||||||||||||||||||||||
| Comment by Valery Khamenya [ 18/Feb/16 ] | |||||||||||||||||||||||||
|
this restriction prohibits creation of ver1 indices without dropping ver0 | |||||||||||||||||||||||||
| Comment by J Rassi [ 26/Mar/14 ] | |||||||||||||||||||||||||
|
Re-opening, this didn't go away in rc2; I think you two are confused.
The issue Kay is reporting here is that db.foo.ensureIndex({foo:1},{name:"kay"}) should return an error, since an index with name "kay" can't be created due to a key pattern conflict with an existing index. | |||||||||||||||||||||||||
| Comment by Kay Kim (Inactive) [ 25/Mar/14 ] | |||||||||||||||||||||||||
|
dan@10gen.com seems to be fixed in rc2. | |||||||||||||||||||||||||
| Comment by Daniel Pasette (Inactive) [ 25/Mar/14 ] | |||||||||||||||||||||||||
|
I can't repro with 2.6.0-rc2. kay.kim@10gen.com, can you check again? |