Skip to content

Documentation / @andrew_l/mongo-transaction / WithMongoTransactionOptions

Interface: WithMongoTransactionOptions<T, K, Args> ​

Type Parameters ​

T ​

T

K ​

K = any

Args ​

Args extends any[] = any[]

Properties ​

connection ​

connection: ConnectionValue

Mongodb connection getter


fn ​

fn: Callback<T, K, Args>

Transaction function that will be executed

⚠️ Possible several times!


logger? ​

optional logger?: Logger

Receives effect and hook errors.

Default ​

ts
logger('TransactionScope')

sessionOptions? ​

optional sessionOptions?: ClientSessionOptions

Transaction session options

Default ​

ts
{
   *   defaultTransactionOptions: {
   *     readPreference: 'primary',
   *     readConcern: { level: 'local' },
   *     writeConcern: { w: 'majority' },
   *   }
   * }

timeoutMS? ​

optional timeoutMS?: number

Configures a timeoutMS expiry for the entire withTransactionCallback.

Remarks ​

  • The remaining timeout will not be applied to callback operations that do not use the ClientSession.
  • Overriding timeoutMS for operations executed using the explicit session inside the provided callback will result in a client-side error.

Released under the MIT License.