Can I use a normal javascript function inside the aggregation pipeline. My query is not about $function operator. I am using cosmosdb for mongo API, which doesn’t support the $function. In one of the stack overflow thread I saw direct usage of function like below
let getStatus = (flag) => {
return flag=='ok' ? 'ok' :'broken';
}
aggregate({
$project: {
'_id': 1,
'status': getStatus($flag3)
}
});
Ref: node.js - Call function inside mongodb's aggregate? - Stack Overflow
Is it possible ?