コード例 #1
0
ファイル: Client.php プロジェクト: MenZil-Team/cms
 /**
  * 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']);
 }
コード例 #2
0
ファイル: MongoDB.php プロジェクト: lewnie/mongo-php-adapter
 /**
  * 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();
 }