从JSON文件创建猫鼬模式时出现问题



是否可以将此JSON文件结构创建为猫鼬模式?mongoose不提供对象类型,我不知道如何实现它。

{
"Mountainbike": {
"Cross": {
"size": [
"395 mm",
"440 mm",
"480 mm",
"535 mm"
],
"color": [
"Himmelblau",
"Grasgrün",
"Stahlgrau",
"Weinrot"
],
"brake": [
"Shimano Deore BRM6000",
"Shimano Deore BRM7000",
"Shimano RX810 1x11"
],
}
}
}

在猫鼬中,这看起来像:

new mongoose.Schema({
Mountainbike: {
type: {
Cross: {
type: {
size: [String],
color: [String],
brake: [String]
}
}
}
}
})

最新更新