mongo_gridfs_init
mongo_gridfs_store
Mongo Функции
PHP Manual

# mongo_gridfs_list

(PECL mongo >= 0.8.0)

mongo_gridfs_list — Query for files in the grid collection

### Описание

resource mongo_gridfs_list ( resource `$gridfs` , array `$query` )

Query for files in the grid collection.

### Список параметров

`gridfs`

  The gridfs connection to use.

`query`

  The file qualities for which to query.

### Возвращаемые значения

Returns a cursor to information about the matching gridfs files.

### Примеры

Пример #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";
}
?>`

Результатом выполнения данного примера будет что-то подобное:

    file1.txt
    file2.txt
    mypic.jpg

depending on what is in the database.

### Смотрите также

- 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

mongo_gridfs_init
mongo_gridfs_store
Mongo Функции
PHP Manual