MongoCollectionfindandmodify()
Finds the first document in the query and updates it
Usage
STRUCTURE = MongoCollectionfindandmodify(
datasource,
collection,
query,
update,
fields,
sort,
returnnew,
upsert
)
Argument | Summary |
---|---|
datasource | datasource name. Name previously created using MongoRegister |
collection | collection name |
query | the query to which to find the object to update |
update | update object to apply |
fields | fields to return [optional] |
sort | sort to apply before picking first object [optional] |
returnnew | if true, the updated document is returned, otherwise the old document is returned (or it would be lost forever) default=false [optional] |
upsert | do upsert (insert if document not present) default=false [optional] |
Calling
Supports named-parameter calling allowing you to use the function like:
MongoCollectionfindandmodify( datasource=?, collection=?, query=?, update=?, fields=?, sort=?, returnnew=?, upsert=? );
Supports passing parameters as a structure using ArgumentCollection:
MongoCollectionfindandmodify( ArgumentCollection={ datasource : ?, collection : ?, query : ?, update : ?, fields : ?, sort : ?, returnnew : ?, upsert : ? } );
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