PHP Portal » PHP Handbuch » MongoCursor::slaveOkay

Werbung

MongoCursor::slaveOkay


(PECL mongo >=0.9.4)

MongoCursor::slaveOkaySets whether this query can be done on a slave

Beschreibung

public MongoCursor MongoCursor::slaveOkay ([ boolean $okay = true ] )

This method will override the static class variable slaveOkay.

Parameter-Liste

okay

If it is okay to query the slave.

Rückgabewerte

Returns this cursor.

Fehler/Exceptions

Throws MongoCursorException if this cursor has started iterating.

Beispiele

PHP Code
1
2
3
4
5
6
7
8
9
10
MongoCursor::$slaveOkay = false; // cannot query slave $cursor = $collection->find(); // can query slave $cursor = $collection->find()->slaveOkay(); MongoCursor::$slaveOkay = true; // can query slave $cursor = $collection->find(); // cannot query slave $cursor = $collection->find()->slaveOkay(false);