Support for non-transactional operations in asynclocalstorage transactions #14736
Closed
Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the feature has not already been requested
🚀 Feature Proposal
mongoose.set('transactionAsyncLocalStorage', true);
const Test = mongoose.model('Test', mongoose.Schema({ name: String }));
const doc1 = new Test({ name: 'test1' });
const doc2 = new Test({ name: 'test2' });
// Save a new doc in a transaction that aborts
await connection.transaction(async() => {
await doc1.save();
await doc2.save(); // Do not want to use transactions in this operation
}).catch(() => {});
It cannot be done without using transactions in an “await doc2.save()” operation
Motivation
No response
Example
No response
Activity