芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/atvcmsTRASH.com.br/maisqtv2/vendor/mongodb/mongodb/src/Operation/Update.php
false, 'upsert' => false, ]; if (isset($options['arrayFilters']) && ! is_array($options['arrayFilters'])) { throw InvalidArgumentException::invalidType('"arrayFilters" option', $options['arrayFilters'], 'array'); } if (isset($options['bypassDocumentValidation']) && ! is_bool($options['bypassDocumentValidation'])) { throw InvalidArgumentException::invalidType('"bypassDocumentValidation" option', $options['bypassDocumentValidation'], 'boolean'); } if (isset($options['collation']) && ! is_array($options['collation']) && ! is_object($options['collation'])) { throw InvalidArgumentException::invalidType('"collation" option', $options['collation'], 'array or object'); } if ( ! is_bool($options['multi'])) { throw InvalidArgumentException::invalidType('"multi" option', $options['multi'], 'boolean'); } if ($options['multi'] && ! \MongoDB\is_first_key_operator($update)) { throw new InvalidArgumentException('"multi" option cannot be true if $update is a replacement document'); } if (isset($options['session']) && ! $options['session'] instanceof Session) { throw InvalidArgumentException::invalidType('"session" option', $options['session'], 'MongoDB\Driver\Session'); } if ( ! is_bool($options['upsert'])) { throw InvalidArgumentException::invalidType('"upsert" option', $options['upsert'], 'boolean'); } if (isset($options['writeConcern']) && ! $options['writeConcern'] instanceof WriteConcern) { throw InvalidArgumentException::invalidType('"writeConcern" option', $options['writeConcern'], 'MongoDB\Driver\WriteConcern'); } if (isset($options['writeConcern']) && $options['writeConcern']->isDefault()) { unset($options['writeConcern']); } $this->databaseName = (string) $databaseName; $this->collectionName = (string) $collectionName; $this->filter = $filter; $this->update = $update; $this->options = $options; } /** * Execute the operation. * * @see Executable::execute() * @param Server $server * @return UpdateResult * @throws UnsupportedException if array filters or collation is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ public function execute(Server $server) { if (isset($this->options['arrayFilters']) && ! \MongoDB\server_supports_feature($server, self::$wireVersionForArrayFilters)) { throw UnsupportedException::arrayFiltersNotSupported(); } if (isset($this->options['collation']) && ! \MongoDB\server_supports_feature($server, self::$wireVersionForCollation)) { throw UnsupportedException::collationNotSupported(); } $bulkOptions = []; if (isset($this->options['bypassDocumentValidation']) && \MongoDB\server_supports_feature($server, self::$wireVersionForDocumentLevelValidation)) { $bulkOptions['bypassDocumentValidation'] = $this->options['bypassDocumentValidation']; } $bulk = new Bulk($bulkOptions); $bulk->update($this->filter, $this->update, $this->createUpdateOptions()); $writeResult = $server->executeBulkWrite($this->databaseName . '.' . $this->collectionName, $bulk, $this->createExecuteOptions()); return new UpdateResult($writeResult); } public function getCommandDocument(Server $server) { $cmd = ['update' => $this->collectionName, 'updates' => [['q' => $this->filter, 'u' => $this->update] + $this->createUpdateOptions()]]; if (isset($this->options['writeConcern'])) { $cmd['writeConcern'] = $this->options['writeConcern']; } if (isset($this->options['bypassDocumentValidation']) && \MongoDB\server_supports_feature($server, self::$wireVersionForDocumentLevelValidation)) { $cmd['bypassDocumentValidation'] = $this->options['bypassDocumentValidation']; } return $cmd; } /** * Create options for executing the bulk write. * * @see http://php.net/manual/en/mongodb-driver-server.executebulkwrite.php * @return array */ private function createExecuteOptions() { $options = []; if (isset($this->options['session'])) { $options['session'] = $this->options['session']; } if (isset($this->options['writeConcern'])) { $options['writeConcern'] = $this->options['writeConcern']; } return $options; } /** * Create options for the update command. * * Note that these options are different from the bulk write options, which * are created in createExecuteOptions(). * * @return array */ private function createUpdateOptions() { $updateOptions = [ 'multi' => $this->options['multi'], 'upsert' => $this->options['upsert'], ]; if (isset($this->options['arrayFilters'])) { $updateOptions['arrayFilters'] = $this->options['arrayFilters']; } if (isset($this->options['collation'])) { $updateOptions['collation'] = (object) $this->options['collation']; } return $updateOptions; } }