added condition to batchInsert against empty arrays
This commit is contained in:
@ -125,11 +125,14 @@ class InsertMongoCommand extends MongoDbCommand
|
||||
|
||||
protected function concreteExecute()
|
||||
{
|
||||
$result = null;
|
||||
if (!$this->multiple) {
|
||||
$result = $this->collection->insert($this->data, array('safe' => $this->safe));
|
||||
$this->insertId = $this->data['_id'];
|
||||
} else {
|
||||
$result = $this->collection->batchInsert($this->data, array('safe' => $this->safe));
|
||||
if (count($this->data)) {
|
||||
$result = $this->collection->batchInsert($this->data, array('safe' => $this->safe));
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user