芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/lot.mgaplay.com.br/vendor/mongodb/mongodb/src/Operation/Delete.php
isDefault()) { unset($options['writeConcern']); } $this->databaseName = (string) $databaseName; $this->collectionName = (string) $collectionName; $this->filter = $filter; $this->limit = $limit; $this->options = $options; } /** * Execute the operation. * * @see Executable::execute() * @param Server $server * @return DeleteResult * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ public function execute(Server $server) { if (isset($this->options['collation']) && ! server_supports_feature($server, self::$wireVersionForCollation)) { throw UnsupportedException::collationNotSupported(); } /* Server versions >= 3.4.0 raise errors for unsupported update options. * For previous versions, the CRUD spec requires a client-side error. */ if (isset($this->options['hint']) && ! server_supports_feature($server, self::$wireVersionForUnsupportedOptionServerSideError)) { throw UnsupportedException::hintNotSupported(); } /* CRUD spec requires a client-side error when using "hint" with an * unacknowledged write concern on an unsupported server. */ if ( isset($this->options['writeConcern']) && ! is_write_concern_acknowledged($this->options['writeConcern']) && isset($this->options['hint']) && ! server_supports_feature($server, self::$wireVersionForHint) ) { throw UnsupportedException::hintNotSupported(); } $inTransaction = isset($this->options['session']) && $this->options['session']->isInTransaction(); if ($inTransaction && isset($this->options['writeConcern'])) { throw UnsupportedException::writeConcernNotSupportedInTransaction(); } $bulk = new Bulk(); $bulk->delete($this->filter, $this->createDeleteOptions()); $writeResult = $server->executeBulkWrite($this->databaseName . '.' . $this->collectionName, $bulk, $this->createExecuteOptions()); return new DeleteResult($writeResult); } /** * Returns the command document for this operation. * * @see Explainable::getCommandDocument() * @param Server $server * @return array */ public function getCommandDocument(Server $server) { $cmd = ['delete' => $this->collectionName, 'deletes' => [['q' => $this->filter] + $this->createDeleteOptions()]]; if (isset($this->options['writeConcern'])) { $cmd['writeConcern'] = $this->options['writeConcern']; } return $cmd; } /** * Create options for the delete command. * * Note that these options are different from the bulk write options, which * are created in createExecuteOptions(). * * @return array */ private function createDeleteOptions() { $deleteOptions = ['limit' => $this->limit]; if (isset($this->options['collation'])) { $deleteOptions['collation'] = (object) $this->options['collation']; } if (isset($this->options['hint'])) { $deleteOptions['hint'] = $this->options['hint']; } return $deleteOptions; } /** * 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; } }