MongoCursorInterface::setReadPreference
(PECL mongo >=1.6.0)
MongoCursorInterface::setReadPreference — Set the read preference for this query
説明
abstract public MongoCursorInterface::setReadPreference
( string
$read_preference
[, array $tags
] ) : MongoCursorInterfaceパラメータ
-
read_preference -
読み込みの優先モード。
MongoClient::RP_PRIMARY、MongoClient::RP_PRIMARY_PREFERRED、MongoClient::RP_SECONDARY、MongoClient::RP_SECONDARY_PREFERREDあるいはMongoClient::RP_NEARESTのいずれか。 -
tags -
ゼロ個以上のタグセットの配列。各タグセット自体も配列で、レプリカセットのメンバーのタグにマッチさせる条件として使います。
返り値
Returns this cursor.
エラー / 例外
パラメータが無効な場合、あるいは優先読み込みモードが MongoClient::RP_PRIMARY のときにタグセットを指定した場合に E_WARNING が発生します。
参考
- The read preferences documentation.
- MongoCursorInterface::getReadPreference() - Get the read preference for this query