[英]Changing Mongoose schema type not working
I have a mongoose schema with a property which was a string array.我有一个带有字符串数组属性的猫鼬模式。
docs: [String]
I changed the type to an object array as follows我将类型更改为对象数组,如下所示
docs: [{ url: String, type: String }]
But when I create a new item, the docs field is still validated with the type string and the following error is thrown.但是当我创建一个新项目时,仍然使用类型字符串验证 docs 字段并引发以下错误。
I even tried dropping the collection and it still not works.我什至尝试删除该集合,但它仍然无法正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.