예제 #1
0
 /**
  * Perform an update query.
  *
  * @param  array  $query
  * @param  array  $options
  * @return int
  */
 protected function performUpdate($query, array $options = [])
 {
     // Update multiple items by default.
     if (!array_key_exists('multiple', $options)) {
         $options['multiple'] = true;
     }
     $wheres = $this->compileWheres();
     $result = $this->collection->UpdateMany($wheres, $query, $options);
     if (1 == (int) $result->isAcknowledged()) {
         return $result->getModifiedCount() ? $result->getModifiedCount() : $result->getUpsertedCount();
     }
     return 0;
 }