I want to call a function in mongodb query. Is there any way to do such thing or is there any other way to do that
Example:
const imageUrl = function(imageName) {
const urlParams = {Bucket: 's3-bucket/uploads', Key: imageName};
s3bucket.getSignedUrl('getObject', urlParams, async function (err, url) {
console.log('imageUrl', url);
});
}
const feedTest = await Feed.aggregate([
{
$project: {
_id: 1,
feedImage: imageUrl(feedImage),
}
}
]);