I'm getting this error while compiling the code node index.
Invalid schema configuration: `undefined` is not a valid type within the array `location`.
When I add this to the Joi validation schema, I get the error.
joi.array().items(joi.array().items(joi.number().integer())).default([]),
The array that I want to validate,
{
// other fields..
location: [[1,32,145], [0,1,null]],
// other field
}
I have tried other iterations to figure out what causes the error.
joi.array().items().default([]) // No error
joi.array().items(joi.number().integer()) // No error
joi.array().items(joi.array().items()) // This caused error
I think adding an array inside an array is causing the error.
IMP NOTE: Using schema like this, and error around this.
new mongoose.Schema(joigoose.convert(PSS), { _id: false, versionKey: false })
I have manually added the array inside an array in MongoDB Document, which means this error is with mongoose, as joi allows array inside an array.