Skip to content
RED SAGSkills
hard20 pts · first answer countsdatabasesmongodbtransactions

One write escapes a MongoDB transaction

In this code, the wallet debit stays after abortTransaction. Why?

const session = client.startSession()
session.startTransaction()
await orders.insertOne(order, { session })
await wallets.updateOne({ _id: uid }, { $inc: { bal: -amt } })
await session.abortTransaction()
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions