私が達成したいどのようなキーストーンフィールドタイプ機能エラーで指定する必要があります - キーストーン
で私は以下のように見えるlabConfigsテーブルを持っています。 LabConfigsテーブルの各項目について、私はDomainテーブルに "UserauthLevel"を保存します。
それでは、私はドメインテーブルに "ブール値のオブジェクトの配列"を作成したいと思います。 以下は同じコードです。以下は
****************LabConfigs*********************** var LabConfigs = new keystone.List('LabConfigs'); LabConfigs.add({ configName: {type: Types.Text, required: true, initial: true, index: true}, description: {type: Types.Text, required: true, initial: true, index: true}, image: {type: Types.Text, required: true, initial: true, index: true}, type: {type: Types.Text, required: true, initial: true, index: true}, version: {type: Types.Text, required: true, initial: true, index: true}, }); ************************************************
ドメインテーブルのための私のコードです: -
**************************Domain table****** var Domain = new keystone.List('Domain'); Domain.add({ domainName: {type: Types.Text, required: true, initial: true, index: true}, labConfigs :{type: Types.Relationship, ref: 'LabConfigs',required: false,many: true}, userauthlevel:[{ type: Types.Boolean}] }); Domain.defaultColumns = 'domainName'; Domain.register();
しかし、これはスロー実行した後、それは私にエラーを与える: - 私は次のコードを試みた。この問題を解決するために
throw new Error('Fields must be specified with a type function'); ^
をドメインテーブル
Domain.schema.add ({ userauthlevel : [{ type: Types.Text }] });
しかしこれも役に立たない。
どのようにこの問題を解決するには、私はそれがマングースで動作するかもしれない知っている。
こんにちは、私はTextArrayの例を見ることができませんでした。 TextArrayの正しい例を教えてください。 –
GitHubリポジトリからのドキュメント[Here's](https://github.com/keystonejs/keystone/tree/master/fields/types/textarray) –
userauthlevelのこのTextArrayに要素を挿入する方法の良い例 –