(PECL mongo >=1.5.0)
Examples:
Adding options to MongoCommandCursor

A MongoCommandCursor has two "life stages": pre- and post- command. When a cursor is created, it has not yet contacted the database, so it is in its pre-command state. When the client first attempts to get a result (by calling MongoCommandCursor::rewind(), directly or indirectly), the cursor moves into the post-command state.

The command cursor's batch size and socket timeout may be configured in both the pre- and post- command states.

<?php

$cursor = new MongoCommandCursor(...);

$cursor = $cursor->batchSize( 4 );

foreach ($cursor as $result) {
    var_dump($result);
}
?>

MongoCommandCursor::batchSize

(PECL mongo >=1.5.0) Limits the number of elements returned in one batch.

2016-02-24 16:20:46
MongoCommandCursor::key

(PECL mongo >=1.5.0) Returns the current result's index within the result set

2016-02-24 16:20:47
MongoCommandCursor::current

(PECL mongo >=1.5.0) Returns the current element

2016-02-24 16:20:47