We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Do you want to request a feature or report a bug?
Report a bug in last version 6.2.8 but not in 6.2.7 or before.
What is the current behavior? Required option on a sub sub sub document failed validator :
<$pwd>/node_modules/mongoose/lib/document.js:2953 this.$__.validationError = new ValidationError(this); ^ ValidationError: Test validation failed: list.0.list.0.name: Path `name` is required. at model.Document.invalidate (<$pwd>>/node_modules/mongoose/lib/document.js:2953:32) at EmbeddedDocument.Subdocument.invalidate (<$pwd>>/node_modules/mongoose/lib/types/subdocument.js:213:12) at EmbeddedDocument.Subdocument.invalidate (<$pwd>>/node_modules/mongoose/lib/types/subdocument.js:213:12) at <$pwd>>/node_modules/mongoose/lib/document.js:2742:17 at <$pwd>>/node_modules/mongoose/lib/schematype.js:1324:9 at processTicksAndRejections (node:internal/process/task_queues:78:11) { errors: { 'list.0.list.0.name': ValidatorError: Path `name` is required. at validate (<$pwd>>/node_modules/mongoose/lib/schematype.js:1321:13) at SchemaString.SchemaType.doValidate (<$pwd>>/node_modules/mongoose/lib/schematype.js:1305:7) at <$pwd>>/node_modules/mongoose/lib/document.js:2734:18 at processTicksAndRejections (node:internal/process/task_queues:78:11) { properties: { validator: [Function (anonymous)], message: 'Path `name` is required.', type: 'required', path: 'name', value: undefined }, kind: 'required', path: 'name', value: undefined, reason: undefined, [Symbol(mongoose:validatorError)]: true } }, _message: 'Test validation failed' }
If the current behavior is a bug, please provide the steps to reproduce.
const mongoose = require('mongoose') mongoose.set('debug', true) const testSchemaSub3 = new mongoose.Schema({ name: { type: String, required: true } }) const testSchemaSub2 = new mongoose.Schema({ name: { type: String, required: true }, list: [testSchemaSub3] }) const testSchemaSub1 = new mongoose.Schema({ name: { type: String, required: true }, list: [testSchemaSub2] }) const testSchema = new mongoose.Schema({ name: String, list: [testSchemaSub1] }) const testModel = mongoose.model('Test', testSchema) async function run () { await mongoose.connect('mongodb://localhost:27017') await mongoose.connection.dropDatabase() const entry1 = await testModel.create({ name: 'lvl1', list: [{ name: 'lvl2', list: [{ name: 'lvl3', // list: [{ // name: 'lvl4' // }] }] }] }) } run()
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node.js: v16.13.2, v16.14.2 and v17.8.0 Mongoose: 6.2.8 (no bug before) MongoDB: v4.4.5
The text was updated successfully, but these errors were encountered:
8ae4a4a
No branches or pull requests
Do you want to request a feature or report a bug?
Report a bug in last version 6.2.8 but not in 6.2.7 or before.
What is the current behavior?
Required option on a sub sub sub document failed validator :
If the current behavior is a bug, please provide the steps to reproduce.
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node.js: v16.13.2, v16.14.2 and v17.8.0
Mongoose: 6.2.8 (no bug before)
MongoDB: v4.4.5
The text was updated successfully, but these errors were encountered: