My example, please help me.
CollectionName.aggregate( [
{ $addFields:
{
message:
{ $function:
{
body: function(name) {
let data = OtherCollection.findOne({....})
................
return data
},
args: [ "$name"],
lang: "js"
}
}
}
}
] )