MongoGridfssave()

Saves a file into a Mongo GridFS bucket returning back the _id of the resulting object

Usage

STRING = MongoGridfssave( datasource, bucket, file, filename, contenttype, _id, metadata )
Argument Summary
datasource datasource name. Name previously created using MongoRegister
bucket GridFS bucket name
file the file to store in the bucket. Either a full path to the file or the binary data of a data
filename the name of the file
contenttype the mime type of the file [optional]
_id the ID of the file if you wish to replace or override this data [optional]
metadata any meta-data to associate with this file [optional]

Calling

Supports named-parameter calling allowing you to use the function like:

MongoGridfssave(
   datasource=?, 
   bucket=?, 
   file=?, 
   filename=?, 
   contenttype=?, 
   _id=?, 
   metadata=?
);

Supports passing parameters as a structure using ArgumentCollection:

MongoGridfssave( ArgumentCollection={
   datasource : ?, 
   bucket : ?, 
   file : ?, 
   filename : ?, 
   contenttype : ?, 
   _id : ?, 
   metadata : ?
} );

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 disk
  • JOURNAL_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 disk
  • MAJORITY
    Exceptions are raised for network issues, and server errors; waits on a majority of servers for the write operation
  • NONE
    No exceptions are raised, even for network issues
  • NORMAL
    Exceptions are raised for network issues, but not server errors
  • REPLICAS_SAFE
    Exceptions are raised for network issues, and server errors; waits for at least 2 servers for the write operation
  • SAFE
    Exceptions are raised for network issues, and server errors; waits on a server for the write operation