MongoDB\Driver\ReadPreference::getMode

(mongodb >=1.0.0)

MongoDB\Driver\ReadPreference::getModeReturns the ReadPreference's "mode" option

说明

final public MongoDB\Driver\ReadPreference::getMode ( void ) : int

参数

此函数没有参数。

返回值

Returns the ReadPreference's "mode" option.

错误/异常

范例

Example #1 MongoDB\Driver\ReadPreference::getMode() example

<?php

$rp 
= new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_PRIMARY);
var_dump($rp->getMode());

$rp = new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_PRIMARY_PREFERRED);
var_dump($rp->getMode());

$rp = new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_SECONDARY);
var_dump($rp->getMode());

$rp = new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_SECONDARY_PREFERRED);
var_dump($rp->getMode());

$rp = new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_NEAREST);
var_dump($rp->getMode());

?>

以上例程会输出:

int(1)
int(5)
int(2)
int(6)
int(10)
相关文章
php mongodb driver cursor returns the id for this cursorphp mongodb driver cursor returns the server associated with this cursorphp mongodb driver manager return the readpreference for the managerphp mongodb driver monitoring commandstartedevent returns the command s request idphp mongodb driver monitoring commandstartedevent returns the server on which the command was executedphp mongodb driver readconcern returns the readconcern s level optionphp mongodb driver readpreference returns an object for bson serializationphp mongodb driver readpreference create a new readpreferencephp mongodb driver readpreference returns the readpreference s maxstalenessseconds optionphp mongodb driver readpreference returns the readpreference s mode optionphp mongodb driver readpreference returns the readpreference s tagsets optionphp mongodb driver server returns the port on which this server is listeningphp mongodb driver server returns an array of tags describing this server in a replica setphp mongodb driver server returns an integer denoting the type of this serverphp mongodb driver writeconcern returns the writeconcern s journal optionphp mongodb driver writeconcern returns the writeconcern s w optionphp mongodb driver writeconcern returns the writeconcern s wtimeout optionphp mongodb driver writeconcernerror returns the writeconcernerror s error messagephp mongodb driver writeerror returns the writeerror s error codephp mongodb driver writeerror returns the index of the write operation corresponding to this writeerror
关注编程学问公众号