當前位置: 首頁>>代碼示例>>PHP>>正文


PHP MongoClient::getWriteConcern方法代碼示例

本文整理匯總了PHP中MongoClient::getWriteConcern方法的典型用法代碼示例。如果您正苦於以下問題:PHP MongoClient::getWriteConcern方法的具體用法?PHP MongoClient::getWriteConcern怎麽用?PHP MongoClient::getWriteConcern使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MongoClient的用法示例。


在下文中一共展示了MongoClient::getWriteConcern方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getWriteConcern

 /**
  * Get an array describing the write concern for this connection
  *
  * @since   1.0.0
  *
  * @link    http://php.net/manual/en/mongo.writeconcerns.php Write Concern
  *
  * @return  array
  */
 public function getWriteConcern()
 {
     // PECL mongo >=1.5.0
     if (version_compare(\MongoClient::VERSION, '1.5.0') >= 0) {
         return $this->connection->getWriteConcern();
     }
     return array('w' => $this->config['connection']['options']['w'], 'wtimeout' => $this->config['connection']['options']['wTimeoutMS']);
 }
開發者ID:MenZil-Team,項目名稱:cms,代碼行數:17,代碼來源:Client.php

示例2: __construct

 /**
  * Creates a new database
  *
  * This method is not meant to be called directly. The preferred way to create an instance of MongoDB is through {@see Mongo::__get()} or {@see Mongo::selectDB()}.
  * @link http://www.php.net/manual/en/mongodb.construct.php
  * @param MongoClient $conn Database connection.
  * @param string $name Database name.
  * @throws Exception
  * @return MongoDB Returns the database.
  */
 public function __construct(MongoClient $conn, $name)
 {
     $this->connection = $conn;
     $this->name = $name;
     $this->setReadPreferenceFromArray($conn->getReadPreference());
     $this->setWriteConcernFromArray($conn->getWriteConcern());
     $this->createDatabaseObject();
 }
開發者ID:lewnie,項目名稱:mongo-php-adapter,代碼行數:18,代碼來源:MongoDB.php


注:本文中的MongoClient::getWriteConcern方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。