|
|
@@ -381,8 +381,10 @@ class Mooses_AbstractMongo extends Mooses_Mongodb_Mongo_Document {
|
|
|
|
|
|
protected function ___load($_value, $_attributeName = NULL){
|
|
|
if(is_null($_attributeName)){
|
|
|
+ $this->loadKey = ['_id' => new MongoId($_value)];
|
|
|
return parent::find($_value);
|
|
|
} else {
|
|
|
+ $this->loadKey = array($_attributeName => $_value);
|
|
|
return parent::fetchOne(array($_attributeName => $_value));
|
|
|
}
|
|
|
}
|
|
|
@@ -412,8 +414,9 @@ class Mooses_AbstractMongo extends Mooses_Mongodb_Mongo_Document {
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
- public function updateData(){
|
|
|
- $_return = $this->update($this->loadKey, array('$set' => $this->_dataUpdate));
|
|
|
+ public function updateData($_criteria = false){
|
|
|
+ $_criteria = $_criteria ?: $this->loadKey;
|
|
|
+ $_return = $this->update($_criteria, array('$set' => $this->_dataUpdate));
|
|
|
return $_return;
|
|
|
}
|
|
|
|