I am getting job failed while running Optic Query in .sjs file. It seems syntax issue in .sjs file for optic query. Can you please help me to provide the correct syntax to run optic query in .sjs file? Please find below code snippet.
const op = require('/MarkLogic/optic');
let k = op.fromView('example','sampleData').select(['firstName']).result();
let t = xs.string(k);
let employeeFirstName = fn.replace(EmployeeFirstName, 'John', t);
-here 'example' is schema name, sampleData is view name and 'firstName' is column name. Its working fine in marklogic qconsole with java script query type but getting issue in .sjs file.