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(), 0, 0, null, null, null);
while (mongo_has_next($cursor)) {
mongo_next($cursor);
echo "."
}
?>
The above example will output a dot for each document in the collection foo.bar.