2017-03-17 10 views
0

シンプルスキーマ、コレクション2、オートフォームをパッケージで使用すると、アプリケーションを構築する際に次のエラーが発生します。流星シンプルスキーマattachSchemaがパッケージ内でクラッシュする

W20170317-16:16:33.466(8)? (STDERR) Error: _constructorOptions key is missing "type" 
W20170317-16:16:33.466(8)? (STDERR)  at /Users/.../jointtest/node_modules/simpl-schema/dist/SimpleSchema.js:858:26 
W20170317-16:16:33.466(8)? (STDERR)  at Function._.each._.forEach (/Users/.../jointtest/node_modules/underscore/underscore.js:158:9) 

メインプログラムに問題はなく、スキーマをコレクションに添付します。

import { Mongo } from 'meteor/mongo'; 

import { Collection2 } from 'meteor/aldeed:collection2-core'; 
import { AutoForm } from 'meteor/aldeed:autoform'; 

import SimpleSchema from 'simpl-schema'; 
SimpleSchema.extendOptions(['autoform']); 
SimpleSchema.debug = true; 

export const Elements = new Mongo.Collection("elements");  
export const PoolSchema = new SimpleSchema({ 
     name: String 
}); 
Elements.attachSchema(PoolSchema); // Error on this statement 

package.js::次のように

import { Template } from 'meteor/templating'; 
import { ReactiveVar } from 'meteor/reactive-var'; 
import { Collection2 } from 'meteor/aldeed:collection2-core'; 
import { AutoForm } from 'meteor/aldeed:autoform'; 

import SimpleSchema from 'simpl-schema'; 
SimpleSchema.extendOptions(['autoform']); 
SimpleSchema.debug = true; 

import './main.html'; 

export const TheElements = new Mongo.Collection("theElements"); 
export const ThePoolSchema = new SimpleSchema({ 
    name: String 
}); 
TheElements.attachSchema(ThePoolSchema); 

パッケージが見えます

Npm.depends({ 
     'simpl-schema': '0.2.3', 
     jointjs: '1.0.3', 
}); 

Package.onUse(function(api) { 
    api.versionsFrom('1.4.3.2'); 
    api.use([ 
     'blaze-html-templates', 
     'ecmascript', 
     'session', 
     'twbs:[email protected]', 
     'aldeed:[email protected]', 
     'momentjs:[email protected]', 
     'aldeed:[email protected]' 
    ]); 
    api.mainModule('af-test.js'); 
}); 

私はおそらく間違って何かをするが、アイデアを使い果たしたが...

答えて

1
export const PoolSchema = new SimpleSchema({ 
    name: String 

});

プロパティnameは、typeである必要があります。

関連する問題