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
Mongoose throws exception when versionKey is explicitly set to true. It assumes it's a new name for the version key.
new mongoose.Schema({
...
}, { versionKey: true });
And here's the exception:
TypeError: Invalid `path`. Must be either string or array
at Object.exports.set (/tmp/TestProject/node_modules/mpath/lib/index.js:97:11)
at Object.exports.setValue (/tmp/TestProject/node_modules/mongoose/lib/utils.js:600:9)
at model.Document.setValue (/tmp/TestProject/node_modules/mongoose/lib/document.js:788:9)
at model.Model.$__version (/tmp/TestProject/node_modules/mongoose/lib/model.js:578:19)
at model.Model.$__handleSave (/tmp/TestProject/node_modules/mongoose/lib/model.js:129:10)
at model.Model.$__save (/tmp/TestProject/node_modules/mongoose/lib/model.js:189:9)
at /tmp/TestProject/node_modules/mongoose/lib/model.js:288:11
at new Promise.ES6 (/tmp/TestProject/node_modules/mongoose/lib/promise.js:45:3)
at model.Model.save (/tmp/TestProject/node_modules/mongoose/lib/model.js:287:10)
at model._done (/tmp/TestProject/node_modules/hooks-fixed/hooks.js:101:24)
at _next (/tmp/TestProject/node_modules/hooks-fixed/hooks.js:64:28)
at fnWrapper (/tmp/TestProject/node_modules/hooks-fixed/hooks.js:186:18)
at model.Object.defineProperty.value.fn (/tmp/TestProject/node_modules/mongoose/lib/schema.js:250:9)
at _next (/tmp/TestProject/node_modules/hooks-fixed/hooks.js:62:30)
at fnWrapper (/tmp/TestProject/node_modules/hooks-fixed/hooks.js:186:18)
at /tmp/TestProject/node_modules/mongoose/lib/schema.js:234:13
The docs aren't really clear about the versionKey property and only mention that setting it to false disables versioning, but in my opinion, the above behavior is completely counterintuitive.
The text was updated successfully, but these errors were encountered:
Mongoose throws exception when
versionKey
is explicitly set to true. It assumes it's a new name for the version key.And here's the exception:
The docs aren't really clear about the
versionKey
property and only mention that setting it to false disables versioning, but in my opinion, the above behavior is completely counterintuitive.The text was updated successfully, but these errors were encountered: