[SERVER-1155] Update with positional operator with regex selector fails Created: 25/May/10 Updated: 12/Jul/16 Resolved: 02/Oct/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Write Ops |
| Affects Version/s: | 1.4.4 |
| Fix Version/s: | 2.5.3 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Okku Touronen | Assignee: | Andrew Morrow (Inactive) |
| Resolution: | Done | Votes: | 3 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Win 7 64bit |
||
| Issue Links: |
|
||||||||||||
| Participants: | |||||||||||||
| Description |
|
> db.t3.insert({_id:1,list:[ {name:"a",val:1}]}) ] } ,{ $set: { "list.$.val" : 2 } },false,true) > db.t3.update( { "list.name" : "a" },{ $set: { "list.$.val" : 2 } },false,true) ] } |
| Comments |
| Comment by Scott Hernandez (Inactive) [ 02/Oct/13 ] | ||||||||||
|
Fixed in code refactoring for 2.5.3:
| ||||||||||
| Comment by Arkadiy Kukarkin [ 25/Apr/13 ] | ||||||||||
|
This is still broken in 2.4.3, now fails with: data:PRIMARY> db.foo.update( { 'list.prop' : /blah/ }, { $unset : { 'list.$.prop' : true } } ); data:PRIMARY> db.foo.update( { 'list.prop' : "blah" }, { $unset : { 'list.$.prop' : true } } ); | ||||||||||
| Comment by Ronald Stalder [ 07/Apr/13 ] | ||||||||||
|
Workaround: > db.t3.update({ "list" : {$elemMatch: {name: /^a$/ }}},{ $set: { "list.$.val" : 3 } },false,true) ] } | ||||||||||
| Comment by Arkadiy Kukarkin [ 24/Oct/12 ] | ||||||||||
|
Confirmed still broken in 2.0.5 and likely 2.2.0 on Ubunu 12.04 x86_64, fails with can't append to array using string field name [$] This is a pretty major bug, looks like regex match doesn't mark the element as 'matched'? |