added butchInsert to mongo model

This commit is contained in:
Anton Grebnev
2012-01-18 23:30:34 +04:00
parent d1723cb87b
commit 99a528fac3
6 changed files with 118 additions and 18 deletions

View File

@ -77,12 +77,13 @@ class MongoDriver extends NoSqlDbDriver
return $this->query($command, $params);
}
public function insert($collection, $data, $safe = true)
public function insert($collection, $data, $multiple = false, $safe = true)
{
$command = MongoCommandBuilder::factory(MongoCommandBuilder::INSERT, $this->getCollection($collection));
$params = array(
'data' => $data,
'safe' => $safe
'safe' => $safe,
'multiple' => $multiple
);
$result = $this->query($command, $params);
$this->last_insert_id = $result->getInsertId();