Рекурсивный акроним словосочетания «PHP: Hypertext Preprocessor»
Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 18554 программиста и 1740 роботов. Сейчас ищут 1357 программистов ...
Using a Cursor to Get All of the Documents
Вернуться к: Tutorial
In order to get all the documents in the collection, we will use MongoCollection::find(). The find() method returns a MongoCursor object which allows us to iterate over the set of documents that matched our query. So to query all of the documents and print them out:
<?php
$connection = new MongoClient();
$collection = $connection->database->collectionName;
$cursor = $collection->find();
foreach ( $cursor as $id => $value )
{
echo "$id: ";
var_dump( $value );
}
?>
See Also
The API documentation on MongoCollection::find() contains more information about finding data.
Вернуться к: Tutorial