MongoDB\Driver\Manager::selectServer
(mongodb >=1.0.0)
MongoDB\Driver\Manager::selectServer — Select a server matching a read preference
説明
final public MongoDB\Driver\Manager::selectServer
( MongoDB\Driver\ReadPreference $readPreference
) : MongoDB\Driver\Server
Selects a MongoDB\Driver\Server matching
readPreference
. This may be used to preselect a server
in order to perform version checking before executing an operation.
注意:
Unlike MongoDB\Driver\Manager::getServers(), this method will initialize database connections and perform server discovery if necessary. See the » Server Selection Specification for additional information.
パラメータ
readPreference
(MongoDB\Driver\ReadPreference)- The read preference to use for selecting a server.
エラー / 例外
- 引数のパースに失敗した場合に MongoDB\Driver\Exception\InvalidArgumentException をスローします。
- サーバーへの接続が認証以外の理由で失敗した場合に MongoDB\Driver\Exception\ConnectionException をスローします。
- 認証が必要な場面で認証に失敗した場合に MongoDB\Driver\Exception\AuthenticationException をスローします。
- Throws MongoDB\Driver\Exception\RuntimeException if a server matching the read preference could not be found.
参考
- MongoDB\Driver\Server
- MongoDB\Driver\Manager::getServers() - Return the servers to which this manager is connected
- » Server Selection Specification