-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Connection.prototype.transaction() return value #9919
Comments
Unfortunately this is a mistake in our docs. The MongoDB driver's |
I got it, thanks. |
@vkarpov15 It seems withTransaction<T = void>(fn: WithTransactionCallback<T>, options?: TransactionOptions): ReturnType<typeof fn>; |
Mongoose version: 5.10.11.
Node.js version: 12.16.3.
MongoDB vresion: 4.4.3 (cloud.mongodb Atlas)
Do you want to request a feature or report a bug?
I think is a bug with Connection.prototype.transaction() return value
What is the current behavior?
This method returns a "CommandResult" instance, but not the value returned by the "fn" callback
This example can be simplified to primitive, but the result is the same:
What is the expected behavior?
As described in the documentation, the method Connection.prototype.transaction() must return a promise that resolves to the value returned by the fn callback. In my example, for simplicity, "1" the number.
I expect something like the following:
The text was updated successfully, but these errors were encountered: