/** * Get whether secondary read queries are allowed for this collection. * * This method wraps getSlaveOkay() for driver versions before 1.3.0. For * newer drivers, this method considers any read preference other than * PRIMARY as a true "slaveOkay" value. * * @see http://php.net/manual/en/mongocollection.getreadpreference.php * @see http://php.net/manual/en/mongocollection.getslaveokay.php * @return boolean */ public function getSlaveOkay() { if (version_compare(phpversion('mongo'), '1.3.0', '<')) { return $this->mongoCollection->getSlaveOkay(); } $readPref = $this->getReadPreference(); return \MongoClient::RP_PRIMARY !== $readPref['type']; }