On update you can use functions like $min $max $inc etc. but I think develop applications would be much easier if there were several more.
e.g.
$dec: yes you can substract values using $inc with negativ numbers, but that looks not nice, but like a hack. So $dec function to decrement would solve this.
$avg: I can calc the average of the old and new value just with the aggregation framework or using a count field and divide my value and the count field. There is no chance to do this work on update (min and max use both arguments too. I think it's not hard to implement a mechanism to use some calculation functions on these arguments on update time).
$div: there is a $mul operator why is there no $div operator to divide numbers?
- is duplicated by
-
SERVER-22940 Add support of more math operations on update
- Closed
- is related to
-
SERVER-11345 Allow update to compute expressions using referenced fields like Aggregation Framework's $project
- Closed