[SERVER-2618] Attempting to create a new index that already exists with diff option fails silently Created: 24/Feb/11 Updated: 12/Jul/16 Resolved: 17/Jun/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Index Maintenance |
| Affects Version/s: | None |
| Fix Version/s: | 2.5.1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Antoine Girbal | Assignee: | Randolph Tan |
| Resolution: | Done | Votes: | 5 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Minor Change | ||||||||||||
| Operating System: | ALL | ||||||||||||
| Participants: | |||||||||||||
| Description |
|
if calling createIndex on already existing index, but with different options (like unique), no error is raised but index is not changed At the end of following, the index is not unique:
|
| Comments |
| Comment by Alexander Yahnev [X] [ 11/Jan/14 ] | |
|
In pymongo 2.6.3 this bug still exists. That's pretty annoying for novice in mongodb, because bug looks like it can be corrected with a simple condition checking. | |
| Comment by Scott Hernandez (Inactive) [ 17/Jun/13 ] | |
|
This is backwards breaking because before an error wasn't generated, and now they will be. | |
| Comment by auto [ 17/Jun/13 ] | |
|
Author: {u'username': u'renctan', u'name': u'Randolph Tan', u'email': u'randolph@10gen.com'}Message: | |
| Comment by John Woakes [ 22/Oct/12 ] | |
|
Also happens when you try an create a TTL index on a field that already has an index. | |
| Comment by Tad Marshall [ 14/Oct/12 ] | |
|
I think that we should fail any request to "create" an existing index with different settings than the existing one. The error code and message should be explicit about the problem, for example:
If we wanted (in a separate ticket) to add a feature to convert an index on-the-fly, that might have some value, but since the workaround is to drop the current index and create a new one with the desired settings, all we really need here is to return an error. | |
| Comment by Daniel Doubrovkine [ 13/Oct/12 ] | |
|
For what it's worth, it took me half a day to narrow a problem to this one - we were "sure" that we have a unique index on something and were still seeing dup data. | |
| Comment by Robert Stam [ 30/Apr/12 ] | |
|
Craig and I recently went back and forth many times with a user who was complaining that his unique index wasn't working only to finally find out that his calls to createIndex with {unique:true}we're being silently ignored because of a pre-existing index that was not unique. I'm not sure what the second call to createIndex should do (recreate the index or give an error message), but silently doing nothing is definitely not the right thing. |