-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for non-transactional operations in asynclocalstorage transactions #14736
Closed
2 tasks done
Labels
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
Milestone
Comments
vkarpov15
added a commit
that referenced
this issue
Jul 12, 2024
vkarpov15
added a commit
that referenced
this issue
Jul 15, 2024
fix(model): support `session: null` option for `save()` to opt out of automatic `session` option with `transactionAsyncLocalStorage`
This was referenced Aug 21, 2024
This was referenced Aug 21, 2024
This was referenced Sep 8, 2024
This was referenced Sep 11, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites
🚀 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
The text was updated successfully, but these errors were encountered: