Sokil\Mongo\Database::readSecondaryPreferred PHP Method

readSecondaryPreferred() public method

public readSecondaryPreferred ( array $tags = null )
$tags array
    public function readSecondaryPreferred(array $tags = null)
    {
        $this->getMongoDB()->setReadPreference(\MongoClient::RP_SECONDARY_PREFERRED, $tags);
        return $this;
    }

Usage Example

Example #1
0
 public function testReadSecondaryPreferred(array $tags = null)
 {
     $this->database->readSecondaryPreferred(array(array('dc' => 'kyiv'), array('dc' => 'lviv')));
     $this->assertEquals(array('type' => \MongoClient::RP_SECONDARY_PREFERRED, 'tagsets' => array(array('dc' => 'kyiv'), array('dc' => 'lviv'))), $this->database->getReadPreference());
 }