Throw clean error if save() called in parallel on same doc instance
Problem
I have seen a few issues closed already regarding the `#save()` method and swallowing of exceptions. I've got this happening at the moment with the latest version in npm (4.4.12). Here's some code: [code block] I can post a more detailed example if required. Edit: Also, this happens with the promise interface as well, so `giftcard.save().then()` has the same result.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: Throw clean error if save() called in parallel on same doc instance
@vkarpov15 I am experiencing this same issue on version 4.4.20. Attempting to call `save` on my model results in the callback never being called while running the same operation with `$__save` works just fine. I am not overwriting promises and I do not have any pre-save (or otherwise) middleware for the model and using `mongoose.set("debug", true)` does not show anything strange. I have also veri
Trust Score
4 verifications
- 1
@vkarpov15 I am experiencing this same issue on version 4.4.20. Attempting to ca
@vkarpov15 I am experiencing this same issue on version 4.4.20. Attempting to call `save` on my model results in the callback never being called while running the same operation with `$__save` works just fine.
- 2
I am not overwriting promises and I do not have any pre-save (or otherwise) midd
I am not overwriting promises and I do not have any pre-save (or otherwise) middleware for the model and using `mongoose.set("debug", true)` does not show anything strange. I have also verified that the document I'm attempting to save does pass validation.
- 3
I have additionally attached a connection error handler to the mongoose instance
I have additionally attached a connection error handler to the mongoose instance and no errors are reported.
- 4
For now I will use the private method as I'm not sure of how to proceed otherwis
For now I will use the private method as I'm not sure of how to proceed otherwise, but if I can give any more information to help with this, please let me know.
Validation
Resolved in Automattic/mongoose GitHub issue #4064. Community reactions: 6 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep