Model.findOneAndUpdate does not allow for a session param #8396
Labels
docs
This issue is due to a mistake or omission in the mongoosejs.com documentation
Milestone
I have a session object and want a Model.findOneAndUpdate operation to be part of a transaction. I stated a question on SO here, but inspecting the typescript definitions I think this is a bug / missing feature in mongoose. You can't pass a session param to
Model.findOneAndUpdate()
Do you want to request a feature or report a bug?
Not sure, kind of both
What is the current behavior?
Model. findOneAndUpdate() does not allow to pass a session in TypeScript. The interface
QueryFindOneAndUpdateOptions
does not have asession
param. The node.js driver however allows to pass a session object: http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#findOneAndUpdateIf the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior?
You should be able to pass a session to findOneAndUpdate
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
mongoose 5.7.12
Link to SO:
https://stackoverflow.com/questions/59156202/use-transaction-in-model-findoneandupdate
The text was updated successfully, but these errors were encountered: