[SERVER-283] Push on objects in virtual collection Created: 06/Sep/09 Updated: 25/Apr/16 Resolved: 25/Apr/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Usability |
| Affects Version/s: | 1.0.0 |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Minor - P4 |
| Reporter: | sandstrom | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 8 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Participants: | |||||||||
| Description |
|
Support for this isn't implemented yet. (May be related to virtual collections.)
use hej;
db.hej.update({_id:1, "answers._id":11}, {"$push":{"answers.comments": {_id:112, text:"I dont agree"} }});
> db.getLastError()
|
| Comments |
| Comment by Ian Whalen (Inactive) [ 25/Apr/16 ] |
|
Closing this as already having been implemented via $push against arrays. Please re-open if we've misunderstood the request. |
| Comment by Coen Hyde [ 15/Apr/10 ] |
|
You can now do your query with a small modification. Just use the positional operator db. hej.update({_id:1, "answers._id":11}, {"$push":{"answers.$.comments": {_id:112, text:"I dont agree"} } } ); |
| Comment by Eliot Horowitz (Inactive) [ 08/Oct/09 ] |
|
would have to be something like: db.hej.$answers.update( { $parent : 1, _id:11 }, {"$push" : { comments : {_id:112, text:"I dont agree" } } } ) |