Skip to content

Documentation / @andrew_l/mongo-transaction / WithMongoTransactionOptions

Interface: WithMongoTransactionOptions<T, K, Args>

Type Parameters

T

K = any

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!


sessionOptions?

optional sessionOptions: ClientSessionOptions

Transaction session options

@default: { 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.