[SERVER-10679] dropDups option for ensureIndex method's option doesn't treat number one as a truthy value. Created: 04/Sep/13 Updated: 10/Dec/14 Resolved: 04/Sep/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Admin |
| Affects Version/s: | 2.4.6 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Yoshiki Shibukawa | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||
| Backwards Compatibility: | Minor Change | ||||||||||||||
| Steps To Reproduce: |
|
||||||||||||||
| Participants: | |||||||||||||||
| Description |
|
ensureIndex treats number one for unique key ( {unique: 1}) as a truthy value, but for dropDups key, number one ( {dropDups: 1}) is invalid. dropDups only accept 'true'. |
| Comments |
| Comment by J Rassi [ 04/Sep/13 ] |
|
This affects the server, not the shell (the shell doesn't examine the index options passed to it) – updated title accordingly. {unique: <integer>} is an unsupported index option, and the fact that it can be used is arguably a bug. See http://docs.mongodb.org/manual/reference/method/db.collection.ensureIndex/ for documentation on what types to use with the various available index options (as such, the option combination {unique: true, dropDups: true} is the only correct way to force a unique index build). A future release of the server may reject invalid index options – see |