Mongo Funktionen
PHP Manual

mongo_next

(PECL mongo >= 0.8.0)

mongo_next — Fetches the next document returned by a query

Beschreibung

array mongo_next ( resource $cursor )

Fetches the next document returned by a query.

Parameter-Liste

cursor

The cursor to use.

Rückgabewerte

The next document.

Fehler/Exceptions

Creates an error if there are no more documents.

Beispiele

Beispiel #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);
}

?>

Siehe auch


Mongo Funktionen
PHP Manual