MongoDB\Database::getReadPreference()
On this page
New in version 1.2.
Definition
Return Values
A MongoDB\Driver\ReadPreference object.
Example
$database = (new MongoDB\Client)->selectDatabase('test', [ 'readPreference' => new MongoDB\Driver\ReadPreference('primaryPreferred'), ]); var_dump($database->getReadPreference());
The output would then resemble:
object(MongoDB\Driver\ReadPreference)#5 (1) { ["mode"]=> string(16) "primaryPreferred" }