-
Type: New Feature
-
Resolution: Duplicate
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
The upsert feature in Mongo is incredibly useful, but it often results in a lot of redundant $set operations when used in conjunction with counters/increment.
This would be incredibly handy:
toSetOnInsert = { }
toSetOnInsert['name'] = 'test'
toInc = { }
toInc['foo'] = 1
vals= { }
vals['$setOnInsert'] = toSetOnInsert
vals['$inc'] = toInc
db.foo.update({_id: "foo"}, vals, true, false);
- duplicates
-
SERVER-340 $setOnInsert modifier for upsert
- Closed