[SERVER-630] $addToSet can cause upsert to fail Created: 12/Feb/10 Updated: 12/Jul/16 Resolved: 12/Feb/10 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Write Ops |
| Affects Version/s: | 1.3.2 |
| Fix Version/s: | 1.3.3 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Andrew Bryan | Assignee: | Eliot Horowitz (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: |
| Description |
|
$addToSet seems to cause an upsert to fail when the document doesn't exist (i.e. it fails to insert). When using $push the document is correctly inserted. For example (perl): $col->update( { '$push' => { 'tags' => 'foo' }, }, { 'upsert' => 1, } ); (where the document id 123 doesn't yet exist) creates: { _id => 123, tags => [ 'foo' ], } which is nice! but the $addToSet equivalent fails to insert anything: $col->update( { '_id' => '123' } , , ); It would be great if it could work the same... |
| Comments |
| Comment by auto [ 12/Feb/10 ] |
|
Author: {'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}Message: fix upsert with addToSet |