问题
Does Keystone JS supports nested schema inside of that array ? I tried adding one but it gives me an error Fields must be specified with a type function. Because I am trying to save an array of objects but I have problem on what field type or schema of the model. Is there a way in keystone to be able to save that data below which is an array of objects ? does the keystone model supports it ? is there a workaroung ?
Sample - The Image Data model is a nested schema but it gives
an error fields must be spe.....
Data.add({
name: { type: String, required: false },
Type: { type: Types.Select, options: 'New, Used,', index: true },
ImageData: [{ Uri: String, Hash: String, Path: String }],
});
Data I wanted to save
ImageData : [
{
"Uri":"Test.com",
"Hash":"42e04950d6f11cd5350e3179083c7c7f",
"Path":"/public/server/img/de29d68ab3594032bef70ead0b0d8fc2.jpg"
},
{
"Uri":"Test.com",
"Hash":"42e04950d6f11cd5350e3179083c7c7f",
"Path":"/public/server/img/de29d68ab3594032bef70ead0b0d8fc2.jpg"
}
]
来源:https://stackoverflow.com/questions/57916821/does-keystone-js-supports-nested-schema-inside-of-that-array