私は、シンプルなシングルスキームの領域で素晴らしいアプリケーションを実行していました。しかし今、私は他のいくつかのスキーマを追加して、1つのスキーマに他のスキーマをリストさせたいと思います。レルムエラー: "JS値はタイプ:数字でなければなりません"
let realm = new Realm({schema: MySchemas});
ラインを実行するときに
は最終的に、私はエラーを取得します。エラーは: "JS値はタイプ:番号でなければなりません"。ここで私は物事をセットアップしている方法です。
Schema.js
'use strict';
let currentSchemaVersion = 0;
const Schema1 = {
name: 'Type1',
primaryKey: 'id',
properties: {
id: {type: 'string', indexed:true},
propOne: 'string',
propTwo: 'string',
propThree: 'int',
propFour: {type: 'list', objectType: 'Type2'},
propFive: {type: 'list', objectType: 'Type3'}
}
};
const Schema2 = {
name: 'Type2',
primaryKey: 'id',
properties:{
id: 'string',
prop1: 'string'
}
};
const Schema3 = {
name: 'Type3',
primaryKey: 'id',
properties:{
id: {type:'string', indexed:true},
propOne: {type:'string', indexed:true},
}
}
export const MySchemas = [Schema1, Schema2, Schema3];
そして、参照元ファイルで、MyComponent.js
'use strict';
import Realm from 'realm';
import * as MySchemas from './Data/Schema.js';
let realm = new Realm({schema: MySchemas}); //BARRRFFFF!
それを呼び出す全体の多くで唯一の番号は右、Type1のからpropThreeのですか?だから私は問題は何とか関連していると思うが、私は内部についての可視性がないので、その取引が何であるかわからない。私はそのプロパティのデフォルトを試してみました。いずれにせよ、それは行かない。
すべての洞察力に感謝します。残念ながら、How to add a nested List of objects in Realm "Error: JS value must be of type: object"は役に立ちません。
編集:私はちょうどネストされたリストを削除し、数字(propThree)だったショー全体の唯一のプロパティと私はまだ同じエラーが発生します。