-
Type: Bug
-
Resolution: Duplicate
-
Priority: Critical - P2
-
None
-
Affects Version/s: 2.4.1
-
Component/s: JavaScript, Querying
-
None
-
Windows
After obtaining a set of documents from my MongoDB, I attempted to iterate through and add the element "Name" to each result, e.g.:
...
{
"_id" : 01234567890
},
...
becomes
...
{
"_id" : 01234567890,
"Name" : "Joe"
},
...
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:
...
{
"_id" : 01234567890,
"Name" : "Joe",
"Name" : "Joe"
},
...
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.
- duplicates
-
SERVER-9066 Field names can be repeated in JavaScript when the same value is set multiple times
- Closed