[SERVER-4462] ensuring unique index on collection with duplicate breaks cursor Created: 08/Dec/11 Updated: 06/Dec/22 Resolved: 22/May/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Index Maintenance |
| Affects Version/s: | 1.8.1, 2.0.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Aaron Heckmann | Assignee: | Backlog - Query Team (Inactive) |
| Resolution: | Cannot Reproduce | Votes: | 9 |
| Labels: | indexing, query | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Ubuntu 11.10 64bit |
||
| Issue Links: |
|
||||
| Assigned Teams: |
Query
|
||||
| Operating System: | Linux | ||||
| Participants: | |||||
| Description |
|
Given a collection A with 10000 documents, each containing one property `name`, in which 2 documents have the same name, if we execute ensureIndex with option unique on name and immediately follow with a find() for all documents, the index fails (as expected) but the find() only returns with 101 documents. Here is an example using Mongoose on Nodejs: |
| Comments |
| Comment by Eric Milkie [ 22/May/18 ] |
|
This is no longer an issue. |
| Comment by Daniel Sinclair [ 13/Jul/12 ] |
|
+1 on Windows x64 I can confirm this breaks a collection with as few as two items. Once you've added an item twice with the same key (where a Unique Index has been applied) it won't (add? or) find anything else after that. Essentially, I think it means you can't use Unique Indexes without safe mode. |
| Comment by Nicholas McCready [ 06/Jul/12 ] |
|
I can confirm this bug in OSX as well. |