Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
MongoDB.CommitTransaction
Commit a multi-document transaction.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
MongoDB | 12.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "MongoDB.CommitTransaction"; MongoDBRef ) More
Parameters
Parameter | Description | Example |
---|---|---|
MongoDBRef | The reference number for the mongo connection. | $MongoDB |
Result
Returns JSON or error.
Description
Commit a multi-document transaction.Returns JSON if the transaction was committed. Raises exception if there are invalid arguments, such as a session with no transaction in progress, or if there is a server or network error.
Examples
Try insert with commit:
# Open connection first, open database and connection
Show Custom Dialog [ "Estimate before" ; MBS( "MongoDB.EstimatedDocumentCount"; $mongo ) ]
#
# insert a record
Set Variable [ $r ; Value: MBS( "MongoDB.InsertOne"; $Mongo; test::Insert JSON) ]
Show Custom Dialog [ "Result" ; $r ]
#
Show Custom Dialog [ "Estimate after insert" ; MBS( "MongoDB.EstimatedDocumentCount"; $mongo ) ]
Set Variable [ $r ; Value: MBS( "MongoDB.CommitTransaction"; $Mongo) ]
#
Show Custom Dialog [ "Estimate after abort" ; MBS( "MongoDB.EstimatedDocumentCount"; $mongo ) ]
See also
- MongoDB.AbortTransaction
- MongoDB.EstimatedDocumentCount
- MongoDB.InsertOne
- MongoDB.InTransaction
- MongoDB.StartTransaction
Release notes
- Version 12.5
Blog Entries
This function checks for a license.
Created 23th September 2022, last changed 24th September 2022