(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.

1
2
3
4
5
6
7
8
9
10
<?php
 
$cursor new MongoCommandCursor(...);
 
$cursor $cursor->batchSize( 4 );
 
foreach ($cursor as $result) {
    var_dump($result);
}
?>
MongoCommandCursor::dead
  • References/PHP/Function/Database/MongoDB driver/MongoCommandCursor

(PECL mongo >=1.5.0) Checks if there are results that have not yet been sent from the database

2025-01-10 15:47:30
MongoCommandCursor::setReadPreference
  • References/PHP/Function/Database/MongoDB driver/MongoCommandCursor

(PECL mongo >=1.6.0) Set the read preference for this command

2025-01-10 15:47:30
MongoCommandCursor::timeout
  • References/PHP/Function/Database/MongoDB driver/MongoCommandCursor

(PECL mongo >=1.6.0) Sets a client-side timeout for this command

2025-01-10 15:47:30
MongoCommandCursor::createFromDocument
  • References/PHP/Function/Database/MongoDB driver/MongoCommandCursor

(PECL mongo >=1.5.0) Create a new command cursor from an existing command response document

2025-01-10 15:47:30
MongoCommandCursor::rewind
  • References/PHP/Function/Database/MongoDB driver/MongoCommandCursor

(PECL mongo >=1.5.0) Executes the command and resets the cursor to the start of the result set

2025-01-10 15:47:30
MongoCommandCursor::getReadPreference
  • References/PHP/Function/Database/MongoDB driver/MongoCommandCursor

(PECL mongo >=1.6.0) Get the read preference for this command

2025-01-10 15:47:30
MongoCommandCursor::valid
  • References/PHP/Function/Database/MongoDB driver/MongoCommandCursor

(PECL mongo >=1.5.0) Checks if the cursor is reading a valid result.

2025-01-10 15:47:30
MongoCommandCursor::info
  • References/PHP/Function/Database/MongoDB driver/MongoCommandCursor

(PECL mongo >=1.5.0) Gets information about the cursor's creation and iteration

2025-01-10 15:47:30
MongoCommandCursor::next
  • References/PHP/Function/Database/MongoDB driver/MongoCommandCursor

(PECL mongo >=1.5.0) Advances the cursor to the next result

2025-01-10 15:47:30
MongoCommandCursor::__construct
  • References/PHP/Function/Database/MongoDB driver/MongoCommandCursor

(PECL mongo >=1.5.0) Create a new command cursor

2025-01-10 15:47:30