MongoCollectionupdate()

Updates the data in mongo

Usage

BOOLEAN = MongoCollectionupdate( datasource, collection, query, data, upsert, multi, writeconcern )
Argument Summary
datasource datasource name. Name previously created using MongoRegister
collection collection name
query the query to which to find the object to update
data data to save into the collection. Can be a single structure, or a JSON string (which will be converted to a structure via Mongo)
upsert if the database should create the element if it does not exist [optional]
multi if the update should be applied to all objects matching [optional]
writeconcern the mode to save the data: FSYNC_SAFE, JOURNAL_SAFE, MAJORITY, NONE, NORMAL (default), REPLICAS_SAFE, SAFE [optional]

Calling

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

MongoCollectionupdate(
   datasource=?, 
   collection=?, 
   query=?, 
   data=?, 
   upsert=?, 
   multi=?, 
   writeconcern=?
);

Supports passing parameters as a structure using ArgumentCollection:

MongoCollectionupdate( ArgumentCollection={
   datasource : ?, 
   collection : ?, 
   query : ?, 
   data : ?, 
   upsert : ?, 
   multi : ?, 
   writeconcern : ?
} );

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