Skip to content

Commit

Permalink
MongoDBRepository::addAll will not add if document array is empty.
Browse files Browse the repository at this point in the history
  • Loading branch information
nilportugues committed Apr 12, 2016
1 parent 7ce1d66 commit 36926ad
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@ public function addAll(array $values)
$documents[][BulkWrite::UPDATE_ONE] = [[$this->primaryKey => $id], ['$set' => $value]];
}
}

if (empty($documents)) {
return [];
}

$result = $this->getCollection()->bulkWrite($documents, $options);
$insertedIds = $result->getInsertedIds();
Expand Down

0 comments on commit 36926ad

Please sign in to comment.