Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/391.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在模式中添加对象(子)可选Javascript(React Native)列表_Javascript_Reactjs_React Native_User Interface_Realm - Fatal编程技术网

如何在模式中添加对象(子)可选Javascript(React Native)列表

如何在模式中添加对象(子)可选Javascript(React Native)列表,javascript,reactjs,react-native,user-interface,realm,Javascript,Reactjs,React Native,User Interface,Realm,事先非常感谢。 我正在开发一个测验应用程序,它有两种答案形式,一种是带有多项选择的答案形式,另一种是开放式问题输入,然后在领域模式中我进行了以下配置 选项模式(可选) const OptionSchema={ 名称:'选项', primaryKey:'id', 特性:{ id:{type:'int',索引为:true}, 描述:“字符串?”, imageSound:“字符串”, 正确:“bool”, 标记为“bool”, 播放“bool”, }, }; 导出默认选项模式; 问题图式 const

事先非常感谢。
我正在开发一个测验应用程序,它有两种答案形式,一种是带有多项选择的答案形式,另一种是开放式问题输入,然后在领域模式中我进行了以下配置

选项模式(可选)
const OptionSchema={
名称:'选项',
primaryKey:'id',
特性:{
id:{type:'int',索引为:true},
描述:“字符串?”,
imageSound:“字符串”,
正确:“bool”,
标记为“bool”,
播放“bool”,
},
};
导出默认选项模式;
问题图式
const QuestionSchema={
姓名:"问题",,
primaryKey:'id',
特性:{
id:{type:'int',索引为:true},
问题形式:“字符串”,
optionForm:'字符串',
typeAnswer:'字符串',
描述:“字符串”,
correctAnswerDescription:'字符串?',
correctAnswerDescriptionId:“字符串?”,
imageSound:“字符串”,
选项:“选项?[]”,
},
};
导出默认模式;
问题 我想知道我该如何保留这些选项
属性:“选项[]”
架构中的Optiocial,因为它没有 阅读文档时会遇到以下情况:
用于属性

displayName:'string',//可选属性
生日:{type:'date',可选:true},//可选属性
用于列表

testScores:'double?[]
尝试 在我的案例中尝试两种方法
第一次尝试

options:{type:'Option[],可选:true},
第二次尝试

选项:'Option?[]
这两种情况都没有奏效
您是否有解决方案?

一个不会解决问题但可能暂时有帮助的选项是:

添加一个空记录,所有未注册的注册都将作为子项指向空。 范例

模式选项
const OptionSchema={
名称:'选项',
primaryKey:'id',
特性:{
id:{type:'int',索引:true,可选:true},
描述:{type:'string',可选:true},
imageSound:{type:'string',可选:true},
正确:{type:'bool',可选:true},
标记:{type:'bool',可选:true},
播放:{type:'bool',可选:true},
},
};
导出默认选项模式;
图式问题
const QuestionSchema={
姓名:"问题",,
primaryKey:'id',
特性:{
id:{type:'int',索引为:true},
问题形式:“字符串”,
optionForm:'字符串',
typeAnswer:'字符串',
描述:“字符串”,
correctAnswerDescription:{type:'string',可选:true},
correctAnswerDescriptionId:{type:'int',可选:true},
imageSound:{type:'string',可选:true},
选项:“选项[]”,
},
};
导出默认模式;
图像-架构选项(子项)

图像-模式问题(父亲)

谢谢大家,我希望在问题得到解决之前我一直在帮助大家