Details
Description
Compass export to languages breaks with template literals (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals)
This happens with basic examples from the mongodb docs:
[{
|
$addFields: {
|
isFound: {
|
$function: {
|
body: function(name) {
|
return hex_md5(name) == "15b0a220baa16331e8d80e15367677ad"; |
},
|
args: ["$name"], |
lang: "js" |
}
|
},
|
message: {
|
$function: {
|
body: function(name, scores) {
|
let total = Array.sum(scores);
|
return `Hello ${name}. Your total score is ${total}.`; |
},
|
args: ["$name", "$scores"], |
lang: "js" |
}
|
}
|
}
|
}]
|
There is no need for the export to language to parse the body of a function, ideally we should just avoid doing that. If that is not possible we may at least want to support template literals in our grammar.
Attachments
Issue Links
- is related to
-
COMPASS-5112 $function NOT working in Node → Returns error 31261
-
- Closed
-