Does Keystone JS supports nested schema inside of that array?

自作多情 提交于 2019-12-11 18:25:15

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!