themeteorchef / base

A starting point for Meteor apps.
http://themeteorchef.com/base
MIT License
695 stars 253 forks source link

Get error when tried to use `SimpleSchema2`! #243

Closed thearabbit closed 7 years ago

thearabbit commented 7 years ago

Get error when tried to use SimpleSchema2

import { Mongo } from 'meteor/mongo';
import SimpleSchema2 from 'simpl-schema';
// import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import { Factory } from 'meteor/dburles:factory';

const Documents = new Mongo.Collection('Documents');
export default Documents;

Documents.allow({
  insert: () => false,
  update: () => false,
  remove: () => false,
});

Documents.deny({
  insert: () => true,
  update: () => true,
  remove: () => true,
});

Documents.schema = new SimpleSchema2({
  title: {
    type: String,
    label: 'The title of the document.',
  },
  body: {
    type: String,
    label: 'The body of the document.',
  },
});

Documents.attachSchema(Documents.schema);

It show

Error: Invalid definition for pick field.
W20170329-10:12:29.516(7)? (STDERR)     at packages/aldeed_simple-schema.js:1429:13
W20170329-10:12:29.516(7)? (STDERR)     at Function._.each._.forEach (packages/underscore.js:147:22)
W20170329-10:12:29.517(7)? (STDERR)     at [object Object].SimpleSchema (packages/aldeed_simple-schema.js:1426:5)
W20170329-10:12:29.517(7)? (STDERR)     at [object Object].c2AttachSchema [as attachSchema] (packages/aldeed_collection2-core.js:62:10)
W20170329-10:12:29.593(7)? (STDERR)     at meteorInstall.imports.api.documents.documents.js (imports/api/documents/documents.js:26:3)
W20170329-10:12:29.593(7)? (STDERR)     at fileEvaluate (packages/modules-runtime.js:197:9)
W20170329-10:12:29.594(7)? (STDERR)     at Module.require (packages/modules-runtime.js:120:16)
W20170329-10:12:29.595(7)? (STDERR)     at Module.Mp.importSync (/Users/theara/.meteor/packages/modules/.0.9.0-beta.13.ag5gz5++os+web.browser+web.cordova/npm/node_modules/reify/lib/runtime.js:88:16)
W20170329-10:12:29.595(7)? (STDERR)     at meteorInstall.imports.api.documents.methods.js (imports/api/documents/methods.js:1:1)
W20170329-10:12:29.595(7)? (STDERR)     at fileEvaluate (packages/modules-runtime.js:197:9)
themeteorchef commented 7 years ago

Base doesn't support the NPM release of SimpleSchema yet. It's best to use the version currently included.