BEGIN
Opens a new FoundationDB transaction on the current session.
Syntax
Section titled “Syntax”BEGINThis command takes no parameters.
Return Value
Section titled “Return Value”Simple string: OK on success.
Behavior
Section titled “Behavior”The command creates a new FoundationDB transaction and binds it to the current session. The session enters explicit transaction mode, which means all subsequent commands that touch FoundationDB will use this transaction until it is committed or rolled back.
When a transaction is opened, the session also initializes post-commit hooks and a user version counter for the lifetime of the transaction.
While in explicit transaction mode, auto-commit behavior is implicitly disabled: commands no longer create their own one-off transactions.
Errors
Section titled “Errors”| Error Code | Description |
|---|---|
TRANSACTION | A transaction is already in progress on the session. |
Examples
Section titled “Examples”Start a transaction:
> BEGINOKAttempt to start a second transaction:
> BEGINOK
> BEGIN(error) TRANSACTION there is already a transaction in progress.