(PECL mongo >= 0.8.0)
mongo_gridfs_list — Query for files in the grid collection
Query for files in the grid collection.
The gridfs connection to use.
The file qualities for which to query.
Returns a cursor to information about the matching gridfs files.
Przykład #1 mongo_gridfs_list() example
This example shows how to list the files in a grid collection.
<?php
$conn = mongo_connect("localhost", true);
if (!$conn) {
die("Could not connect.");
}
// create a new grid connection
$gridfs = mongo_gridfs_init($conn, "blog", "fs");
// query for the filename
$cursor = mongo_gridfs_list($gridfs, array("filename" => "profilePic.jpg"));
while (mongo_has_next($cursor)) {
$f = mongo_next($cursor);
echo $f["filename"] . "\n";
}
?>
Powyższy przykład wyświetli coś podobnego do:
file1.txt file2.txt mypic.jpg
depending on what is in the database.