coen-hyde/Shanty-Mongo — Issue #59: $pull from documentset
Author: yanek1988
Created: 2011-12-23 21:08:00+00:00
State: open

Hi
I have following structure in my collection:
"laboratory" : {
"mixtures" : [
{
"id" : ObjectId("4ef0ede2948b80fe1fb591d3"),
"name" : "ZZZ"
}
],
}
and I want to pull this mixture. I tried
$this->doc->pull('laboratory.mixtures',array('id'=>new MongoId('4ef0ede2948b80fe1fb591d3')));
$this->doc->laboratory->mixtures->pull('id',array(new MongoId('4ef0ede2948b80fe1fb591d3')));

but it is not working. Why? This code works but it is not clean way:
Model_Collections_Users::update(array('_id'=>$this->doc->_id),
array('$pull'=>array('laboratory.mixtures'=> array('id'=>new MongoId('4ef0ede2948b80fe1fb591d3')))));