Mongo Functions
PHP Manual

mongo_has_next

(PECL mongo >= 0.8.0)

mongo_has_nextChecks if a cursor has any more documents to return

Description

bool mongo_has_next ( resource $cursor )

Checks if a cursor has any more documents to return.

Parameters

cursor

The database cursor to check.

Return Values

If there is another document to return.

Examples

Example #1 mongo_has_next() example

This example shows how mongo_has_next can be used to iterate through results.

<?php

$conn 
mongo_connect("localhost"true);
if (!
$conn) {
   die(
"Could not connect.");
}
$cursor mongo_query($conn"foo.bar", array(), 00nullnullnull);
while (
mongo_has_next($cursor)) {
   
mongo_next($cursor);
   echo 
"."
}

?>

The above example will output a dot for each document in the collection foo.bar.

See Also


Mongo Functions
PHP Manual