(PECL mongo >= 0.8.0)
mongo_next — Fetches the next document returned by a query
Fetches the next document returned by a query.
The cursor to use.
The next document.
Creates an error if there are no more documents.
Example #1 mongo_next() example
This example uses mongo_has_next and mongo_next to iterate through query results and storing them in an array.
<?php
$conn = mongo_connect("localhost", true);
if (!$conn) {
die("Could not connect.");
}
$cursor = mongo_query($conn, "foo.bar", array(), 0, 0, null, null, null);
$results = array();
while (mongo_has_next($cursor)) {
$results[] = mongo_next($cursor);
}
?>