[SERVER-5282] duplicate key results Created: 11/Mar/12 Updated: 25/Oct/21 Resolved: 25/Oct/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | JavaScript, Shell |
| Affects Version/s: | None |
| Fix Version/s: | features we're not sure of |
| Type: | Question | Priority: | Major - P3 |
| Reporter: | Wes Widner | Assignee: | DO NOT USE - Backlog - Platform Team |
| Resolution: | Won't Do | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: |
| Description |
|
Using the cxx driver I managed to create an object containing the following fields: { _id: ObjId(4f59f734a695f63cb649e03b), a: 1, a: 2, a: 3, a: 4 }In most drivers (PHP, PyMongo, Java, node.js) the result of retrieving the object is predictably: { _id: ObjId(4f59f734a695f63cb649e03b), a: 4 }However in the shell I get: > db.persons.find().forEach(printjson) What I'm curious about is why the shell uses the first value of "a" instead of the last one. |
| Comments |
| Comment by Eliot Horowitz (Inactive) [ 11/Mar/12 ] |
|
The behavior in this case is undefined from javascript. |