[SERVER-22893] Update should provide more than $inc $min $max etc. Created: 29/Feb/16  Updated: 06/Dec/22  Resolved: 29/Jun/19

Status: Closed
Project: Core Server
Component/s: Querying, Write Ops
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Ben [X] Assignee: Backlog - Query Team (Inactive)
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-22940 Add support of more math operations o... Closed
Related
is related to SERVER-11345 Allow update to compute expressions u... Closed
Assigned Teams:
Query
Participants:

 Description   

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?



 Comments   
Comment by Asya Kamsky [ 29/Jun/19 ]

SERVER-40381 implemented support for aggregation expressions to specify update for 4.2. 

You can see some examples here.

Generated at Thu Feb 08 04:01:44 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.