Commit d340f1fa authored by Jeremy Mikola's avatar Jeremy Mikola

Fix iteration on operations in bulkWrite()

parent adff7f0f
...@@ -198,17 +198,17 @@ class Collection ...@@ -198,17 +198,17 @@ class Collection
* *
* @see Collection::getBulkOptions() for supported $options * @see Collection::getBulkOptions() for supported $options
* *
* @param array $bulk Array of operations * @param array $ops Array of operations
* @param array $options Additional options * @param array $options Additional options
* @return WriteResult * @return WriteResult
*/ */
public function bulkWrite(array $bulk, array $options = array()) public function bulkWrite(array $ops, array $options = array())
{ {
$options = array_merge($this->getBulkOptions(), $options); $options = array_merge($this->getBulkOptions(), $options);
$bulk = new BulkWrite($options["ordered"]); $bulk = new BulkWrite($options["ordered"]);
foreach ($bulk as $n => $op) { foreach ($ops as $n => $op) {
foreach ($op as $opname => $args) { foreach ($op as $opname => $args) {
if (!isset($args[0])) { if (!isset($args[0])) {
throw new InvalidArgumentException(sprintf("Missing argument#1 for '%s' (operation#%d)", $opname, $n)); throw new InvalidArgumentException(sprintf("Missing argument#1 for '%s' (operation#%d)", $opname, $n));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment