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