0

我正在使用 React-native 的 Javascript 领域

我想生成一个领域模式来保存一个 Object 数组,如下所示:

arrayOfObj:[{ key1:1111, key2:2222, key3:333 }]

到目前为止我尝试的是在我的模式中使用混合类型

const mySchema = {
    name: "mySchema",
    properties: {
        _id: "objectId",
        arrOfObj: "mixed" //'have used mixed[] too but they all don't work
    }
}

我尝试过使用混合混合 [],但是当我尝试插入对象数组时出现错误:mySchema.arrOfObj must be of type 'mixed?[]', got 'object' ([object Object]) ]。

现在,领域中对象数组的正确数据类型是什么?

4

1 回答 1

1
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",
 }

};

于 2021-08-09T12:11:50.320 回答