I'm using the MongoDB aggregation framework and need to take the absolute value of an amount field, which I use in both the project portion and the group portion, ex:
'$project' => {
'amount' => 1,
'_id' => 0
}
....
'$group' => {
'total' => {'$sum' => '$amount'}
}
How do you take the absolute value of the 'amount' field in this case? I wasn't able to find it in the docs (maybe it's not available?)