-
Type: New Feature
-
Resolution: Won't Do
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Write Ops
-
None
-
Query
$inc is great to increment an existing field by a given amount, however for a newly created document you should be able to set the initial value for the field, rather than to assume it should be the same as the increment value.
Change
{ $inc: { <field1>: <amount1>, <field2>: <amount2>, ... } }
To
{ $inc: { <field1>: {start:<value1>, next:<amount1}, <field2>: {start:<value2>, next:<amount2}, ... } }
This need became apparent when using upsert = true on an update with a field that is normally incremented if it exists, but should have a user defined starting value when it does not.
- is related to
-
SERVER-2643 Allow Field Name Duplication with Modifiers
- Closed
- related to
-
SERVER-6566 Support conditional updates: $updates
- Closed