Details
-
New Feature
-
Resolution: Won't Do
-
Major - P3
-
None
-
None
-
None
-
Query
Description
$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.
Attachments
Issue Links
- is related to
-
SERVER-2643 Allow Field Name Duplication with Modifiers
-
- Closed
-
- related to
-
SERVER-6566 Support conditional updates: $updates
-
- Closed
-