MongoCursor::skip
MongoCursor::snapshot
MongoCursor
PHP Manual

# MongoCursor::slaveOkay

(PECL mongo >=0.9.4)

MongoCursor::slaveOkay — Sets whether this query can be done on a slave

### 説明

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

This method will override the static class variable slaveOkay.

### パラメータ

`okay`

  If it is okay to query the slave.

### 返り値

Returns this cursor.

### エラー / 例外

Throws MongoCursorException if this cursor has started iterating.

### 例

例1 MongoCursor::slaveOkay() example

`<?php
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);
?>`

MongoCursor::skip
MongoCursor::snapshot
MongoCursor
PHP Manual