[SERVER-398] Having leading comments in Javascript can break db.eval() Created: 30/Oct/09 Updated: 12/Jul/16 Resolved: 10/Nov/09 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | JavaScript |
| Affects Version/s: | None |
| Fix Version/s: | 1.1.4 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Eliot Horowitz (Inactive) | Assignee: | Eliot Horowitz (Inactive) |
| Resolution: | Done | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: |
| Description |
|
This works: > db.eval(/dieinafire/function() {return [true];})[true] As does this: > db.eval("function(){return [true];} ") Starting with a string with a comment does not: > db.eval("/dieinafire/function() {return [true];}") mstearn in #mongodb said: < mstearn> yup, function literal vs sting with function So I guess this is a known behavior. However, it's completely non- Is there a way to db.eval() javascript code that starts with a comment Obviously for now I've just removed the comment, but I wasted an Thanks, |
| Comments |
| Comment by auto [ 10/Nov/09 ] |
|
Author: {'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}Message: handle comments at the beginning of code |
| Comment by Michael Schurter [ 02/Nov/09 ] |
|
Wrapping my code in a pymongo.code.Code() object allows me to start with a comment. Perhaps a leading comment only breaks the data_code BSON type and not the data_code_w_scope type? |