downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

MongoGridFS::__construct> <MongoCursor::valid
Last updated: Wed, 25 Nov 2009

view this page in

The MongoGridFS class

Introduction

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)));

?>

Class synopsis

MongoGridFS
extends MongoCollection {
/* Fields */
public MongoCollection $chunks = NULL ;
protected string $filesName = NULL ;
protected string $chunksName = NULL ;
/* Methods */
__construct ( MongoDB $db [, string $files = NULL [, string $chunks = NULL ]] )
public array drop ( void )
public MongoGridFSCursor find ([ array $query = array() [, array $fields = array() ]] )
public MongoGridFSFile findOne ([ mixed $query = array() ] )
public boolean remove ([ array $criteria = array() [, boolean $just_one = FALSE ]] )
public mixed storeBytes ( string $bytes [, array $extra = array() ] )
public mixed storeFile ( string $filename [, array $extra = array() ] )
public mixed storeUpload ( string $name [, string $filename ] )
}

Table of Contents



add a note add a note User Contributed Notes
MongoGridFS
There are no user contributed notes for this page.

MongoGridFS::__construct> <MongoCursor::valid
Last updated: Wed, 25 Nov 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites