-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: JavaScript
-
None
This works:
> db.eval(/dieinafire/function()
{return [true];})[true]
As does this:
> db.eval("function(){return [true];}
")
[true]
Starting with a string with a comment does not:
> db.eval("/dieinafire/function()
{return [true];}")
null
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-
obvious when you run into it via a client library.
Is there a way to db.eval() javascript code that starts with a comment
via pymongo?
Obviously for now I've just removed the comment, but I wasted an
afternoon trying to figure out why in the world some perfectly valid
Javascript wasn't executing.
Thanks,
schmichael