Hi,
I have an aggregation pipeline like this:
{
group: {
objectId: '$project',
depositPeriodSum: {
$sum: '$depositPeriod',
},
borrowedAllTime: {
$sum: '$loanValue',
},
},
}
This pipeline works fine. DepositPeriodSum is pretty straightforward, but I would like to modify it a little. Instead of summing depositPeriod I would like to sum something like depositPeriod * (4 + zugModifier), where zugModifier is another column in database. Also zugModifier is sometimes undefined so I would also need to do something like (zugModifier || 0).
Is it possible to do calculations like that within the pipeline? I couldn’t find it anywhere in the docs.