The CloudAnt server says it is using CouchDB 3.4.2, and ES6 support was added to CouchDB in version 3.0..., but I am not able to use fat arrow function syntax in the online view editor for my database. Is this a limitation of the editor, or of CloudAnt?
for example:
function (keys, values, rereduce) {
const uniqWith = (arr, fn) =>
arr.filter(
(element, index) => arr.findIndex((step) => fn(element, step)) === index
);
return uniqWith(values, (a, b) => a.moves === b.moves )
}
I get an error saying this is not a function.
IBM Cloudant supports QuickJS as JavaScript Engine, as announced here.
QuickJS supports ES2023, so the arrow function syntax should work.
However, you need to specify via the language
property that you want to use QuickJS in your DesignDoc:
{
"_id": "/design/myddoc",
"views": {
"myView": {
"map": "function(doc) {...}",
}
},
"language": "javascript_quickjs"
}