You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
When I use { writeConcern: { w: 0, j: false } } schema options I got the error DocumentNotFoundError: No document found for query "{ _id: new ObjectId("61f794106eb7091ff50bdc62") }" on model "X" after saving documents.
If the current behavior is a bug, please provide the steps to reproduce.
You have to run several mongodb instances, primary and several secondary databases. Then you have to define any model like:
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node: v14.18.1
Mongoose: 6.1.8
MongoDB server version: 5.0.5
The text was updated successfully, but these errors were encountered:
vkarpov15
added
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
and removed
has repro script
There is a repro script, the Mongoose devs need to confirm that it reproduces the issue
labels
Feb 5, 2022
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
When I use
{ writeConcern: { w: 0, j: false } }
schema options I got the errorDocumentNotFoundError: No document found for query "{ _id: new ObjectId("61f794106eb7091ff50bdc62") }" on model "X"
after saving documents.If the current behavior is a bug, please provide the steps to reproduce.
You have to run several mongodb instances, primary and several secondary databases. Then you have to define any model like:
and then after connection established
What is the expected behavior?
Function
.save
executes without any error.Since I set up
writeConcern.w = 0
to the schema options, there is unnecessary block code https://github.com/Automattic/mongoose/blob/master/lib/model.js#L382#L421 which is not needed to be executed.get(options, 'w')
returnsundefined
, despite the fact that options equals{ writeConcern: { w: 0, j: false } }
.I assume that the problem is in https://github.com/Automattic/mongoose/blob/master/lib/helpers/schema/applyWriteConcern.js . 10, 13, 16 lines should be the same as 21, 24, 27.
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node: v14.18.1
Mongoose: 6.1.8
MongoDB server version: 5.0.5
The text was updated successfully, but these errors were encountered: