(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); } ?>