[SERVER-9442] Query results edited in javascript can create duplicate elements in the same document. Created: 23/Apr/13 Updated: 10/Dec/14 Resolved: 24/Apr/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | JavaScript, Querying |
| Affects Version/s: | 2.4.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | Kevin Wingham | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Operating System: | Windows | ||||||||
| Participants: | |||||||||
| Description |
|
After obtaining a set of documents from my MongoDB, I attempted to iterate through and add the element "Name" to each result, e.g.: ... becomes ... This was run on tens of thousands of entries. It almost always worked as expected, however it occasionally (1 - 5 across the entire dataset) produced entries which looked like this: ... This data would then cause a corrupt entry when committed back to the DB. I viewed this information printed directly from javascript, before committing back to the DB. I also noticed that if I explicitly set the variable "Name" twice back to back, it went ahead and duplicated the key every time, setting the values of both instances to the one most recently specified. This does not happen if I create an array of test data right in JS, it ONLY occurred when modifying the results of a MongoDB query. |
| Comments |
| Comment by Kevin Wingham [ 23/Apr/13 ] |
|
Yes that looks like exactly what it was! Apologies for reviving a solved bug, and thank-you for the help. |
| Comment by J Rassi [ 23/Apr/13 ] |
|
I believe you're encountering |