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< DBClientCursor > | list (BSONObj query) |
auto_ptr< DBClientCursor > | list () |
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 } )
returns a file object matching the query
BSONObj mongo::GridFS::insertFile |
( |
const string & |
name, |
|
|
const OID & |
id, |
|
|
gridfs_offset |
length, |
|
|
const string & |
contentType | |
|
) |
| | [private] |
convenience method to get all the files with a filter
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 |
) |
|
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
Member Data Documentation
The documentation for this class was generated from the following file: