mongo::GridFS Class Reference

#include <gridfs.h>

List of all members.

Public Member Functions

GridFile findFile (const string &fileName)
GridFile findFile (BSONObj query)
 GridFS (DBClientBase &client, const string &dbName, const string &prefix="fs")
auto_ptr< DBClientCursorlist (BSONObj query)
auto_ptr< DBClientCursorlist ()
void removeFile (const string &fileName)
void setChunkSize (unsigned int size)
BSONObj storeFile (const char *data, size_t length, const string &remoteName, const string &contentType="")
BSONObj storeFile (const string &fileName, const string &remoteName="", const string &contentType="")
 ~GridFS ()

Private Member Functions

BSONObj insertFile (const string &name, const OID &id, gridfs_offset length, const string &contentType)

Private Attributes

unsigned int _chunkSize
string _chunksNS
DBClientBase_client
string _dbName
string _filesNS
string _prefix

Friends

class GridFile

Detailed Description

GridFS is for storing large file-style objects in MongoDB.

See also:
http://www.mongodb.org/display/DOCS/GridFS+Specification

Definition at line 55 of file gridfs.h.


Constructor & Destructor Documentation

mongo::GridFS::GridFS ( DBClientBase client,
const string &  dbName,
const string &  prefix = "fs" 
)
Parameters:
client - db connection
dbName - root database name
prefix - if you want your data somewhere besides <dbname>.fs
mongo::GridFS::~GridFS (  ) 

Member Function Documentation

GridFile mongo::GridFS::findFile ( const string &  fileName  ) 

equiv to findFile( { filename : filename } )

GridFile mongo::GridFS::findFile ( BSONObj  query  ) 

returns a file object matching the query

BSONObj mongo::GridFS::insertFile ( const string &  name,
const OID id,
gridfs_offset  length,
const string &  contentType 
) [private]
auto_ptr<DBClientCursor> mongo::GridFS::list ( BSONObj  query  ) 

convenience method to get all the files with a filter

auto_ptr<DBClientCursor> mongo::GridFS::list (  ) 

convenience method to get all the files

void mongo::GridFS::removeFile ( const string &  fileName  ) 

removes file referenced by fileName from the db

Parameters:
fileName filename (in GridFS) of the file to remove
Returns:
the file object
void mongo::GridFS::setChunkSize ( unsigned int  size  ) 
Parameters:
 
BSONObj mongo::GridFS::storeFile ( const char *  data,
size_t  length,
const string &  remoteName,
const string &  contentType = "" 
)

puts the file represented by data into the db

Parameters:
data pointer to buffer to store in GridFS
length length of buffer
remoteName optional filename to use for file stored in GridFS (default is to use fileName parameter)
contentType optional MIME type for this object. (default is to omit)
Returns:
the file object
BSONObj mongo::GridFS::storeFile ( const string &  fileName,
const string &  remoteName = "",
const string &  contentType = "" 
)

puts the file reference by fileName into the db

Parameters:
fileName local filename relative to process
remoteName optional filename to use for file stored in GridFS (default is to use fileName parameter)
contentType optional MIME type for this object. (default is to omit)
Returns:
the file object

Friends And Related Function Documentation

friend class GridFile [friend]

Definition at line 131 of file gridfs.h.


Member Data Documentation

unsigned int mongo::GridFS::_chunkSize [private]

Definition at line 126 of file gridfs.h.

string mongo::GridFS::_chunksNS [private]

Definition at line 125 of file gridfs.h.

Definition at line 121 of file gridfs.h.

string mongo::GridFS::_dbName [private]

Definition at line 122 of file gridfs.h.

string mongo::GridFS::_filesNS [private]

Definition at line 124 of file gridfs.h.

string mongo::GridFS::_prefix [private]

Definition at line 123 of file gridfs.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


mongodb
Author(s): Nate Koenig
autogenerated on Fri Jan 11 12:15:55 2013