The MongoGridFS class
Introdução
Utilities for storing and retrieving files from the database.
MongoGridFS extends MongoCollection, so any of the methods in MongoCollection can be used to manipulate metadata. For example:
<?php
// save a file
$id = $grid->storeFile("game.tgz");
$game = $grid->findOne();
// add a downloads counter
$game->file['downloads'] = 0;
$grid->save($game->file);
// increment the counter
$grid->update(array("_id" => $id), array('$inc' => array("downloads" => 1)));
?>
Sinopse da classe
Índice
- MongoGridFS::__construct — Creates new file collections
- MongoGridFS::drop — Drops the files and chunks collections
- MongoGridFS::find — Queries for files
- MongoGridFS::findOne — Returns a single file matching the criteria
- MongoGridFS::remove — Removes files from the collections
- MongoGridFS::storeBytes — Chunkifies and stores bytes in the database
- MongoGridFS::storeFile — Stores a file in the database
- MongoGridFS::storeUpload — Saves an uploaded file to the database
MongoGridFS
There are no user contributed notes for this page.
