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