[SERVER-6047] $pullAll causes empty embedded object field to be created Created: 08/Jun/12 Updated: 11/Jul/16 Resolved: 03/Jul/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Write Ops |
| Affects Version/s: | None |
| Fix Version/s: | 2.0.7, 2.2.0-rc0 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Michael O'Brien | Assignee: | Richard Kreuter (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Operating System: | ALL | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
This looks like unusual behavior. For example with a document like: { "_id" : ObjectId("4fd2736696a0c5567029c674"), "x" : 10 }Issuing an update with $pullAll on a key that does not exist inside an embedded doc causes the field to be created: db.test.update( {x:10}, {$pullAll : {"test.a" : ["foo", "bar"]}}) The (empty) embedded object "test" will now exist in the doc: I would have expected no change in the document's fields if the $pullAll references a key that does not exist. |
| Comments |
| Comment by auto [ 02/Jul/12 ] |
|
Author: {u'date': u'2012-07-02T12:12:34-07:00', u'name': u'Richard Kreuter', u'email': u'richard@10gen.com'}Message: Don't grow a document on $pull/$pullAll. |
| Comment by auto [ 02/Jul/12 ] |
|
Author: {u'date': u'2012-07-02T12:39:41-07:00', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}Message: fix compile |
| Comment by auto [ 02/Jul/12 ] |
|
Author: {u'date': u'2012-07-02T12:12:34-07:00', u'email': u'richard@10gen.com', u'name': u'Richard Kreuter'}Message: Don't grow a document on $pull/$pullAll. |
| Comment by Richard Kreuter (Inactive) [ 20/Jun/12 ] |
|
For what it's worth, $pull does this, too. |