Namespace: transactions
transactions
Provides functions to open, commit, or
rollback multi-statement transactions. The client must have been
created for a user with the rest-writer role.
Methods
-
commit(txid)
-
Finishes a multi-statement transaction by applying the changes.
Parameters:
Name Type Description txid
string | transactions.Transaction a string transaction id or Transaction object identifying an open multi-statement transaction -
open(transactionName, timeLimit, withState) → {string|transactions.Transaction}
-
Creates a multi-statement transaction, providing a transactionId or Transaction object to pass to write, read, and remove functions before calling the transactions#commit or transactions#rollback function to finish the transaction.
Parameters:
Name Type Argument Description transactionName
string <optional>
a label to assign to the transaction for easier recognition in reports timeLimit
number <optional>
the maximum number of seconds that the transaction should run before rolling back automatically withState
boolean <optional>
whether to return a Transaction object that can track the properties of the transaction Returns:
either a string transactionId (the default) or a Transaction object identifying the multi-statement transaction; in the next major release, the Transaction object will become the default and the string transactionId will be deprecated.- Type
- string | transactions.Transaction
-
read(txid) → {object}
-
Reads the current state of a multi-statement transaction created with the transactions#open function.
Parameters:
Name Type Description txid
string | transactions.Transaction a string transaction id or Transaction object identifying an open multi-statement transaction Returns:
information about the transaction- Type
- object
-
rollback(txid)
-
Finishes a multi-statement transaction by reverting the changes.
Parameters:
Name Type Description txid
string | transactions.Transaction a string transaction id or Transaction object identifying an open multi-statement transaction
Type Definitions
-
Transaction
-
An object representing a multi-statement transaction on the server.
Type:
- object