[SERVER-1887] dropIndex not working if a name was specified during the ensureIndex Created: 05/Oct/10 Updated: 04/Feb/15 Resolved: 09/Oct/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Admin, Usability |
| Affects Version/s: | 1.6.0 |
| Fix Version/s: | 2.2.2, 2.3.0 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Alvin Richards (Inactive) | Assignee: | Tad Marshall |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
All |
||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Operating System: | ALL | ||||||||||||
| Participants: | |||||||||||||
| Description |
|
Problem: Reproduce: Do the following
Workaround: Use db.runCommand({dropIndexes...} ) to drop a index with a name. Business Case: |
| Comments |
| Comment by auto [ 06/Nov/12 ] |
|
Author: {u'date': u'2012-10-09T09:41:27Z', u'email': u'tad@10gen.com', u'name': u'Tad Marshall'}Message: Remove the fixup of the user's index specification that was converting |
| Comment by Tad Marshall [ 09/Oct/12 ] |
|
Docs should mention that the shell's dropIndex() method on collections accepts two syntaxes: db.collectionName.dropIndex( "indexName" ) ) Both of these should work in all versions if no explicit name was specified when the index was created. If a name was specified, only the first syntax will work until this fix is in the code. |
| Comment by auto [ 09/Oct/12 ] |
|
Author: {u'date': u'2012-10-09T02:41:27-07:00', u'email': u'tad@10gen.com', u'name': u'Tad Marshall'}Message: Remove the fixup of the user's index specification that was converting |
| Comment by Tad Marshall [ 09/Oct/12 ] |
|
The example given of using dropIndex isn't the correct syntax for this helper function. To drop an index by name, you should use:
The way that you could do this for an index without a specified name,
fails if the index has a specified name that doesn't match the autogenerated name, but this can be fixed in the helper function. |