mongo_gridfs_list
(PECL mongo >= 0.8.0)
mongo_gridfs_list — Query for files in the grid collection
Descrição
resource mongo_gridfs_list
( resource $gridfs
, array $query
)
Query for files in the grid collection.
Parâmetros
- gridfs
-
The gridfs connection to use.
- query
-
The file qualities for which to query.
Valor Retornado
Returns a cursor to information about the matching gridfs files.
Exemplos
Exemplo #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";
}
?>
O exemplo acima irá imprimir algo similar a:
file1.txt file2.txt mypic.jpg
depending on what is in the database.
Veja Também
- mongo_gridfs_init() - Creates a new gridfs connection
- mongo_gridfs_find() - Find a file in the database
- mongo_gridfs_store() - Store a file in the database
User Contributed Notes
mongo_gridfs_list
mongo_gridfs_list
There are no user contributed notes for this page.

mongo_gridfs_init