Skip to content
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

Transactions on document methods #145

Open
nicholasfoden opened this issue Sep 4, 2023 · 1 comment
Open

Transactions on document methods #145

nicholasfoden opened this issue Sep 4, 2023 · 1 comment

Comments

@nicholasfoden
Copy link

Currently I cannot see a way to perform a delete() on a document using a transaction.

Would it be possible to add an options object to the arguments in the same way mongoose's remove method currently does?

Proposed example usage

async function myRemoveMethod(myQuery, mySession) {
    const mydoc = await myModel.findOne(myQuery).session(mySession)
    mydoc.delete(deletedBy, { session: mySession }, callback)
}

Thanks for looking at this issue 🙏

@Yuniac
Copy link

Yuniac commented May 24, 2024

Currently I cannot see a way to perform a delete() on a document using a transaction.

Would it be possible to add an options object to the arguments in the same way mongoose's remove method currently does?

Proposed example usage

async function myRemoveMethod(myQuery, mySession) {
    const mydoc = await myModel.findOne(myQuery).session(mySession)
    mydoc.delete(deletedBy, { session: mySession }, callback)
}

Thanks for looking at this issue 🙏

How about this?

 await myModel.delete(myQuery).session(session) <-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants