[英]Create a Mongoose Schema of type Array of Maps
I am trying to create a mongoose schema that is an array of Maps that are String -> String:我正在尝试创建一个猫鼬模式,它是一个字符串数组 -> 字符串:
var daySchema = new mongoose.Schema({
schedule: {
type: [Map],
of: String
}
});
This is what I have, but it's giving me a validation error.这就是我所拥有的,但它给了我一个验证错误。
You could do this:你可以这样做:
var daySchema = new mongoose.Schema({
schedule: {
type: [{type: Map, of: String}],
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.