领域中对象数组的数据类型 - react-native realm
Data type for an array of Object in realm - react-native realm
我正在使用 React-native
Javascript 领域
我想生成一个领域模式来保存对象数组,如下所示:
arrayOfObj:[{ key1:1111, key2:2222, key3:333 }]
到目前为止我已经尝试在我的架构中使用 mixed 类型
const mySchema = {
name: "mySchema",
properties: {
_id: "objectId",
arrOfObj: "mixed" //'have used mixed[] too but they all don't work
}
}
我尝试使用 mixed 并且还使用 mixed[] 但是当我尝试插入对象数组时出现错误: mySchema.arrOfObj 必须是 'mixed?[]' 类型,得到 'object' ([object Object])].
现在,领域中对象数组的正确数据类型是什么?
const myScheme = {
name: "myScheme",
primaryKey: "_id",
properties: {
_id: "objectId",
_partition: "string",
name: "string",
tasks: "myData[]"
}
};
const myData = {
name: "myData",
primaryKey: "_id",
properties: {
_id: "objectId",
_partition: "string",
firstname: "string",
lastname: "string",
}
};
我正在使用 React-native
Javascript 领域我想生成一个领域模式来保存对象数组,如下所示:
arrayOfObj:[{ key1:1111, key2:2222, key3:333 }]
到目前为止我已经尝试在我的架构中使用 mixed 类型
const mySchema = {
name: "mySchema",
properties: {
_id: "objectId",
arrOfObj: "mixed" //'have used mixed[] too but they all don't work
}
}
我尝试使用 mixed 并且还使用 mixed[] 但是当我尝试插入对象数组时出现错误: mySchema.arrOfObj 必须是 'mixed?[]' 类型,得到 'object' ([object Object])].
现在,领域中对象数组的正确数据类型是什么?
const myScheme = {
name: "myScheme",
primaryKey: "_id",
properties: {
_id: "objectId",
_partition: "string",
name: "string",
tasks: "myData[]"
}
};
const myData = {
name: "myData",
primaryKey: "_id",
properties: {
_id: "objectId",
_partition: "string",
firstname: "string",
lastname: "string",
}
};