I'm currently in the process of developing a schema for a specific example:
{
"foods": [
{
"fruits": [{
"apple": {
"color": "red",
"shape": "round"
}
}]
}
]
}
Initially, I attempted the following structure, which theoretically should work but encounters a bug as identified in 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,
},
},
],
},
},
}],
},
});
However, it appears to have some issues. I encountered a
TypeError: Cannot read property 'toLowerCase' of undefined
. This error is likely due to the presence of nested arrays or objects.
In addition, I came across
TypeMismatch: Expected foods.0.fruits to be of type object, instead found type object.
. When attempting to modify the schema in an effort to address this issue, it was not the solution.
- This was observed in version 2.7.0.