我正在尝试为以下示例创建架构:
{
"foods": [
{
"fruits": [{
"apple": {
"color": "red",
"shape": "round"
}
}]
}
]
}
我最初试图做以下结构,这在技术上是正确的,应该可以工作,但由于https://github.com/dynamoose/dynamoose/issues/909中发现的错误而失败。
export const FoodsSchema = new dynamoose.Schema({
foods: {
type: Array,
schema: [{
type: Object,
schema: {
fruits: {
type: Array,
schema: [{
apple: {
type: Object,
schema: {
color: String,
shape: String,
},
},
],
},
},
}],
},
});
但是,它似乎不起作用。越来越TypeError: Cannot read property 'toLowerCase' of undefined
。由于嵌套数组或对象,会发生小写错误。
我也看到了TypeMismatch: Expected foods.0.fruits to be of type object, instead found type object.
后者发生在我试图改变架构时认为可能是它,但这不是问题。
- 这是使用版本 2.7.0。