[SERVER-3440] Add $setOnInsert command Created: 18/Jul/11  Updated: 18/Jul/11  Resolved: 18/Jul/11

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor - P4
Reporter: Ryan Nitz Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-340 $setOnInsert modifier for upsert Closed
Participants:

 Description   

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);



 Comments   
Comment by Eliot Horowitz (Inactive) [ 18/Jul/11 ]

See SERVER-340

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