MongoGridfsget()
Downloads the given file from the Mongo GridFS bucket. If successful and 'filepath' will return TRUE, otherwise FALSE if the file was not found. If not using 'filepath', then the function will return the object. You can get the file specifying either file name, _id or a query. It multiple match, it will return the first one.
Usage
OBJECT = MongoGridfsget(
datasource,
bucket,
filepath,
filename,
_id,
query,
overwrite
)
Argument | Summary |
---|---|
datasource | datasource name. Name previously created using MongoRegister |
bucket | GridFS bucket name |
filepath | the full file name and path where you want the file to be written; if not used, then file is returned with the function as either a string or binary object depending on the mimetype |
filename | the name of the files to find [defaults] [optional] |
_id | the _id of the file to find [optional] |
query | the query to find [optional] |
overwrite | flag to control whether or not the local file is overwritten, defaults to true. If false and file exists, an exception will be thrown [optional] |
Calling
Supports named-parameter calling allowing you to use the function like:
MongoGridfsget( datasource=?, bucket=?, filepath=?, filename=?, _id=?, query=?, overwrite=? );
Supports passing parameters as a structure using ArgumentCollection:
MongoGridfsget( ArgumentCollection={ datasource : ?, bucket : ?, filepath : ?, filename : ?, _id : ?, query : ?, overwrite : ? } );
Extra
For more information on using MongoDB, visit the MongoCFML page
For functions that update data, you can pass in the writeconcern. The possible values are:
FSYNC_SAFE
Exceptions are raised for network issues, and server errors; the write operation waits for the server to flush the data to diskJOURNAL_SAFE
Exceptions are raised for network issues, and server errors; the write operation waits for the server to group commit to the journal file on diskMAJORITY
Exceptions are raised for network issues, and server errors; waits on a majority of servers for the write operationNONE
No exceptions are raised, even for network issuesNORMAL
Exceptions are raised for network issues, but not server errorsREPLICAS_SAFE
Exceptions are raised for network issues, and server errors; waits for at least 2 servers for the write operationSAFE
Exceptions are raised for network issues, and server errors; waits on a server for the write operation
See Also
MongoCollectionaggregate
MongoCollectioncount
MongoCollectiondistinct
MongoCollectiondrop
MongoCollectionfind
MongoCollectionfindandmodify
MongoCollectionfindone
MongoCollectiongroup
MongoCollectionindexdrop
MongoCollectionindexensure
MongoCollectioninsert
MongoCollectionlist
MongoCollectionmapreduce
MongoCollectionremove
MongoCollectionrename
MongoCollectionsave
MongoCollectionstats
MongoCollectionupdate
MongoDatabasedrop
MongoDatabaselist
MongoDatabaseruncmd
MongoDatabasestats
MongoDeregister
MongoGridfsfind
MongoGridfsfindone
MongoGridfsget
MongoGridfsremove
MongoGridfssave
MongoIsvalid
MongoObjectid
MongoRegister