[SERVER-14771] Update using runCommand is order sensitive in its command object fields Created: 02/Aug/14 Updated: 11/Feb/15 Resolved: 17/Nov/14 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | 2.6.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Kevin Willows | Assignee: | Ramon Fernandez Marina |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||
| Backwards Compatibility: | Major Change | ||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||
| Steps To Reproduce: | 1. On any database execute the following command:
will produce:
Now reorder the fields:
Expected result for either condition:
|
||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||
| Description |
|
Doing an update using runCommand returns an error unless the first field in the command object is the command itself. update:<collection> Is this by design? Objects and JSON are intrinsically unordered so expecting fields in the command object to be in a specific order seems incongruous. This is a blocking issue for sending commands over the wire as you cannot guarantee JSON field ordering. The only place you can garantee this is if you manually enter the commands in the shell. |
| Comments |
| Comment by Ramon Fernandez Marina [ 17/Nov/14 ] |
|
This ticket was recently re-opened for re-evaluation. After some internal discussion we've come to the conclusion that making runCommand parameters order-insensitive would be a very large undertaking affecting both the server and drivers, would have some performance limitations, may require changes to the wire protocol, and may break existing applications. We're therefore re-closing this ticket. Users looking for an API to runCommand that uses unordered hashes may consider requesting such feature in the relevant driver project (for example, see PERL-452). |
| Comment by Scott Hernandez (Inactive) [ 02/Aug/14 ] |
|
This is how the command system is designed. All languages, including the javascript shell, support ordering for documents. BSON is ordered so the issue is only related to converting from the language constructs to BSON. |