[SERVER-21740] Shell can't print invalid or native functions stored in a document Created: 02/Dec/15 Updated: 14/Apr/16 Resolved: 09/Mar/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | JavaScript, Shell |
| Affects Version/s: | 2.6.11, 3.0.7, 3.2.0-rc5 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Trivial - P5 |
| Reporter: | Robert Guo (Inactive) | Assignee: | Robert Guo (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Operating System: | ALL | ||||||||
| Steps To Reproduce: |
|
||||||||
| Sprint: | TIG 11 (03/11/16) | ||||||||
| Participants: | |||||||||
| Description |
|
attempting to store and find an invalid or native function from the shell gives a SyntaxError. It looks like the cause is that the shell attempts to eval a function in a document, which would fail if the function is invalid.
|
| Comments |
| Comment by Robert Guo (Inactive) [ 09/Mar/16 ] | ||||||||||
|
fixed as a result of | ||||||||||
| Comment by Kevin Pulo [ 03/Mar/16 ] | ||||||||||
|
Looks like this can be resolved as either Duplicate or Gone Away, courtesy of
| ||||||||||
| Comment by Robert Guo (Inactive) [ 02/Dec/15 ] | ||||||||||
|
max.hirschhorn pointed out the root cause is that the code is being eval'd here automatically. https://github.com/mongodb/mongo/blob/r3.2.0-rc5/src/mongo/scripting/mozjs/valuereader.cpp#L55-L56 and the error message is generate here: https://github.com/mongodb/mongo/blob/r3.2.0-rc5/src/mongo/scripting/mozjs/implscope.cpp#L769 There would be a similar error message on the server if we wrapped the find in a db.eval
One possible fix for this would be to add a Code data type to the shell. |