Hi,
I’m trying to perform two operations within a transaction but it’s really frustrating to see the Don't use transactions in MongoDB
advice everywhere. That makes me overthink everything.
Here if i want to block a user (isBlocked = true
), I should also mark their conversation as closed (isClosed = true
).
Should i avoid transactions here?
await Promise.all([
User.updateOne({ _id: data.id }, {
isBlocked: true,
}, { session }),
Conversation.updateOne({ user: data.id }, {
isClosed: true,
}, { session }),
]);