Sokil\Mongo\Database::readSecondaryPreferred PHP 메소드

readSecondaryPreferred() 공개 메소드

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

예제 #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());
 }