当前位置: 首页>>代码示例>>PHP>>正文


PHP MongoClient::getReadPreference方法代码示例

本文整理汇总了PHP中MongoClient::getReadPreference方法的典型用法代码示例。如果您正苦于以下问题:PHP MongoClient::getReadPreference方法的具体用法?PHP MongoClient::getReadPreference怎么用?PHP MongoClient::getReadPreference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MongoClient的用法示例。


在下文中一共展示了MongoClient::getReadPreference方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __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

示例2: __construct

 /**
  * Create a new cursor
  *
  * @param MongoClient $client     - Database connection.
  * @param string      $ns         - Full name of database and collection.
  * @param array       $query      - Database query.
  * @param array       $fields     - Fields to return.
  */
 public function __construct(MongoClient $client, $ns, array $query = [], array $fields = [])
 {
     $this->client = $client;
     $this->readPreference = $client->getReadPreference();
     $this->fcn = $ns;
     $this->fields = $fields;
     $this->query['$query'] = $query;
     $this->queryTimeout = self::$timeout;
 }
开发者ID:arthurdarcet,项目名称:mongofill,代码行数:17,代码来源:MongoCursor.php

示例3: getReadPreference

 /**
  * Wrapper method for MongoClient::getReadPreference().
  *
  * For driver versions between 1.3.0 and 1.3.3, the return value will be
  * converted for consistency with {@link Connection::setReadPreference()}.
  *
  * @see http://php.net/manual/en/mongoclient.getreadpreference.php
  * @return array
  */
 public function getReadPreference()
 {
     $this->initialize();
     return $this->mongoClient->getReadPreference();
 }
开发者ID:doctrine,项目名称:mongodb,代码行数:14,代码来源:Connection.php

示例4: __construct

 /**
  * Creates a new database
  *
  * @param MongoClient $client - Database connection.
  * @param string $name - Database name.
  */
 public function __construct(MongoClient $client, $name)
 {
     $this->name = $name;
     $this->client = $client;
     $this->readPreference = $client->getReadPreference();
 }
开发者ID:Wynncraft,项目名称:mongofill,代码行数:12,代码来源:MongoDB.php


注:本文中的MongoClient::getReadPreference方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。