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
errors: {
foo: CastError: Cast to Boolean failed for value "undefined" at path "foo"
at model.$set (./mongoose-bug/node_modules/mongoose/lib/document.js:1274:9)
at model._handleIndex (./mongoose-bug/node_modules/mongoose/lib/document.js:996:14)
at model.$set (./mongoose-bug/node_modules/mongoose/lib/document.js:937:22)
at model.Document (./mongoose-bug/node_modules/mongoose/lib/document.js:146:12)
at model.Model (./mongoose-bug/node_modules/mongoose/lib/model.js:106:12)
at new model (./mongoose-bug/node_modules/mongoose/lib/model.js:4675:15)
at ./mongoose-bug/node_modules/mongoose/lib/model.js:3041:22
at ./mongoose-bug/node_modules/mongoose/lib/model.js:3077:7
at Array.forEach (<anonymous>)
at ./mongoose-bug/node_modules/mongoose/lib/model.js:3076:15
at ./mongoose-bug/node_modules/mongoose/lib/helpers/promiseOrCallback.js:31:5
at new Promise (<anonymous>)
at promiseOrCallback (./mongoose-bug/node_modules/mongoose/lib/helpers/promiseOrCallback.js:30:10)
at Function.create (./mongoose-bug/node_modules/mongoose/lib/model.js:3011:10)
at ./mongoose-bug/test.js:17:15
at processTicksAndRejections (internal/process/task_queues.js:93:5) {
stringValue: '"undefined"',
messageFormat: undefined,
kind: 'Boolean',
value: undefined,
path: 'foo',
reason: TypeError: Cannot read property 'omitUndefined' of undefined
at SchemaBoolean._castNullish (./mongoose-bug/node_modules/mongoose/lib/schema/boolean.js:233:93)
at SchemaBoolean.SchemaType.applySetters (./mongoose-bug/node_modules/mongoose/lib/schematype.js:1066:17)
at model.$set (./mongoose-bug/node_modules/mongoose/lib/document.js:1227:20)
at model._handleIndex (./mongoose-bug/node_modules/mongoose/lib/document.js:996:14)
at model.$set (./mongoose-bug/node_modules/mongoose/lib/document.js:937:22)
at model.Document (./mongoose-bug/node_modules/mongoose/lib/document.js:146:12)
at model.Model (./mongoose-bug/node_modules/mongoose/lib/model.js:106:12)
at new model (./mongoose-bug/node_modules/mongoose/lib/model.js:4675:15)
at ./mongoose-bug/node_modules/mongoose/lib/model.js:3041:22
at ./mongoose-bug/node_modules/mongoose/lib/model.js:3077:7
at Array.forEach (<anonymous>)
at ./mongoose-bug/node_modules/mongoose/lib/model.js:3076:15
at ./mongoose-bug/node_modules/mongoose/lib/helpers/promiseOrCallback.js:31:5
at new Promise (<anonymous>)
at promiseOrCallback (./mongoose-bug/node_modules/mongoose/lib/helpers/promiseOrCallback.js:30:10)
at Function.create (./mongoose-bug/node_modules/mongoose/lib/model.js:3011:10)
}
},
If the current behavior is a bug, please provide the steps to reproduce.
This is currently a showstopper for us on 5.10...none of our bulk updates are working. Is there a workaround for this issue until the fix is out? Thanks!
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
Aug 26, 2020
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Crashing with an error within an error. That is:
If the current behavior is a bug, please provide the steps to reproduce.
Here is a small snippet demonstrating the issue:
Simply commenting the
updateOne
line seems to make the issue go away.updateMany
seems to have the same behavior.What is the expected behavior?
No error.
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node.js 14.8.0, Mongoose 5.10.0, MongoDB 4.2.8
The text was updated successfully, but these errors were encountered: