function getActiveTransaction():
| undefined
| Transaction<Record<string, unknown>>
function getActiveTransaction():
| undefined
| Transaction<Record<string, unknown>>
Defined in: packages/db/src/transactions.ts:93
Gets the currently active ambient transaction, if any Used internally by collection operations to join existing transactions
| undefined | Transaction<Record<string, unknown>>
The active transaction or undefined if none is active
// Check if operations will join an ambient transaction
const ambientTx = getActiveTransaction()
if (ambientTx) {
console.log('Operations will join transaction:', ambientTx.id)
}
// Check if operations will join an ambient transaction
const ambientTx = getActiveTransaction()
if (ambientTx) {
console.log('Operations will join transaction:', ambientTx.id)
}