芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/cepali/cache/stores/mongodb/MongoDB/Operation/InsertOne.php
isDefault()) { unset($options['writeConcern']); } $this->databaseName = (string) $databaseName; $this->collectionName = (string) $collectionName; $this->document = $document; $this->options = $options; } /** * Execute the operation. * * @see Executable::execute() * @param Server $server * @return InsertOneResult * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ public function execute(Server $server) { $options = []; if (isset($this->options['bypassDocumentValidation']) && \MongoDB\server_supports_feature($server, self::$wireVersionForDocumentLevelValidation)) { $options['bypassDocumentValidation'] = $this->options['bypassDocumentValidation']; } $bulk = new Bulk($options); $insertedId = $bulk->insert($this->document); $writeResult = $server->executeBulkWrite($this->databaseName . '.' . $this->collectionName, $bulk, $this->createOptions()); return new InsertOneResult($writeResult, $insertedId); } /** * Create options for executing the bulk write. * * @see http://php.net/manual/en/mongodb-driver-server.executebulkwrite.php * @return array */ private function createOptions() { $options = []; if (isset($this->options['session'])) { $options['session'] = $this->options['session']; } if (isset($this->options['writeConcern'])) { $options['writeConcern'] = $this->options['writeConcern']; } return $options; } }