[SERVER-7521] Error is produced to the screen, but command executes anyway. Created: 31/Oct/12 Updated: 15/Feb/13 Resolved: 31/Oct/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell, Usability |
| Affects Version/s: | 2.0.7 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | dabest1 | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows XP Professional, Service Pack 3, 32-bit |
||
| Operating System: | ALL |
| Participants: |
| Description |
|
An error is shown when attempting to use help() function in the wrong context: "Wed Oct 31 00:38:51 TypeError: d.update( {'for':"ac3"}, {$inc:{price:2}}) has no properties (shell):1" Expected behavior: fail the query if it has incorrect syntax. Here is an example in mongo shell: , {price:1}).sort({_id:1}).pretty() { "_id" : ObjectId("507d95d5719dbef170f15bf9"), "price" : 21 } { "_id" : ObjectId("507d95d5719dbef170f15bfb"), "price" : 42 } { "_id" : ObjectId("507d95d5719dbef170f15bfc"), "price" : 30.5 } { "_id" : ObjectId("507d95d5719dbef170f15bfd"), "price" : 14 }> d.update( {for: "ac3"}, {$inc: {price: 2}} ).help() , {$inc:{price:2}}) has no , {price:1}).sort({_id:1}).pretty() { "_id" : ObjectId("507d95d5719dbef170f15bf9"), "price" : 21 } { "_id" : ObjectId("507d95d5719dbef170f15bfb"), "price" : 42 } { "_id" : ObjectId("507d95d5719dbef170f15bfc"), "price" : 32.5 } { "_id" : ObjectId("507d95d5719dbef170f15bfd"), "price" : 14 }> |
| Comments |
| Comment by Scott Hernandez (Inactive) [ 31/Oct/12 ] |
|
The error you are seeing is due to you acting on the result of the update operation on the client (in javascript), not a server command or operation. Since the (javascript) shell allows you to run arbitrary javascript code the shell is not able to verify every line before fully executing it; this is how the javascript interpreter works and is normal behavior. |