|
MongoCursor::timeoutSets a client-side timeout for this query Description
public MongoCursor MongoCursor::timeout
( int
$ms
)A timeout can be set at any time and will affect subsequent queries on the cursor, including fetching more results from the database. Parameters
Return ValuesThis cursor. Errors/ExceptionsCauses methods that fetch results to throw a MongoCursorTimeoutException if the query takes longer than the specified number of milliseconds. ExamplesExample #1 MongoCursor::timeout example In the following example, the driver will wait forever for the initial database response, and then wait 100ms for subsequent responses.
<?php NotesWarning
This does not cause the MongoDB server to cancel long-running operations; it only instructs the driver to stop waiting for a response and throw a MongoCursorTimeoutException after a set time. |