GridFS is for storing large file-style objects in MongoDB.
More...
#include <gridfs.h>
|
| GridFS (DBClientBase &client, const std::string &dbName, const std::string &prefix="fs") |
|
void | setChunkSize (unsigned int size) |
|
BSONObj | storeFile (const std::string &fileName, const std::string &remoteName="", const std::string &contentType="") |
| puts the file reference by fileName into the db More...
|
|
BSONObj | storeFile (const char *data, size_t length, const std::string &remoteName, const std::string &contentType="") |
| puts the file represented by data into the db More...
|
|
void | removeFile (const std::string &fileName) |
| removes file referenced by fileName from the db More...
|
|
GridFile | findFile (Query query) const |
| returns a file object matching the query
|
|
GridFile | findFileByName (const std::string &fileName) const |
| equiv to findFile( { filename : filename } )
|
|
std::auto_ptr< DBClientCursor > | list () const |
| convenience method to get all the files
|
|
std::auto_ptr< DBClientCursor > | list (BSONObj query) const |
| convenience method to get all the files with a filter
|
|
GridFS is for storing large file-style objects in MongoDB.
- See also
- http://dochub.mongodb.org/core/gridfsspec
mongo::GridFS::GridFS |
( |
DBClientBase & |
client, |
|
|
const std::string & |
dbName, |
|
|
const std::string & |
prefix = "fs" |
|
) |
| |
- Parameters
-
client | - db connection |
dbName | - root database name |
prefix | - if you want your data somewhere besides <dbname>.fs |
void mongo::GridFS::removeFile |
( |
const std::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 std::string & |
fileName, |
|
|
const std::string & |
remoteName = "" , |
|
|
const std::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
BSONObj mongo::GridFS::storeFile |
( |
const char * |
data, |
|
|
size_t |
length, |
|
|
const std::string & |
remoteName, |
|
|
const std::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 | filename to use for file stored in GridFS |
contentType | optional MIME type for this object. (default is to omit) |
- Returns
- the file object
The documentation for this class was generated from the following file: