использование attachSchema с простой схемой Meteor не удается - PullRequest
0 голосов
/ 23 июня 2018

Я пытаюсь добавить симплешему в коллекцию монго, но она не удалась. Вот что я делаю:

import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import { check } from 'meteor/check';
import SimpleSchema from 'simpleschema';

export const Initiatives = new Meteor.Collection('initiatives');

InitiativesSchema = new SimpleSchema({
    title: { type: String },
    createdAt: { type: Date },
    owner: { type: String },
    username: { type: Date },
    businessOutcomes:{ type: Array },
    goals: { type: Array },
    startDate: { type: Date },
    endDate: { type: Date },
  });



  Initiatives.schema = InitiativesSchema
  Initiatives.attachSchema(InitiativesSchema)

Я получаю сообщение об ошибке на схеме:

W20180623-21:42:31.536(2)? (STDERR) /Users/mhe/.meteor/packages/meteor-tool/.1.7.0_3.1usvb0v.htn6++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280
W20180623-21:42:31.536(2)? (STDERR)                                             throw(ex);
W20180623-21:42:31.536(2)? (STDERR)                                             ^
W20180623-21:42:31.537(2)? (STDERR)
W20180623-21:42:31.537(2)? (STDERR) Error: Invalid definition for structure field: "title" is not a supported property
W20180623-21:42:31.537(2)? (STDERR)     at /Users/mhe/projects/iambossy/node_modules/simpl-schema/dist/SimpleSchema.js:1117:13
W20180623-21:42:31.537(2)? (STDERR)     at Array.forEach (<anonymous>)
W20180623-21:42:31.537(2)? (STDERR)     at checkAndScrubDefinition (/Users/mhe/projects/iambossy/node_modules/simpl-schema/dist/SimpleSchema.js:1115:27)
W20180623-21:42:31.538(2)? (STDERR)     at /Users/mhe/projects/iambossy/node_modules/simpl-schema/dist/SimpleSchema.js:595:9
W20180623-21:42:31.538(2)? (STDERR)     at Array.forEach (<anonymous>)
W20180623-21:42:31.538(2)? (STDERR)     at SimpleSchema.extend (/Users/mhe/projects/iambossy/node_modules/simpl-schema/dist/SimpleSchema.js:580:30)
W20180623-21:42:31.538(2)? (STDERR)     at new SimpleSchema (/Users/mhe/projects/iambossy/node_modules/simpl-schema/dist/SimpleSchema.js:140:10)
W20180623-21:42:31.538(2)? (STDERR)     at Collection.c2AttachSchema [as attachSchema] (packages/aldeed:collection2/collection2.js:46:10)
W20180623-21:42:31.538(2)? (STDERR)     at initiatives.js (imports/api/initiatives/initiatives.js:26:15)
W20180623-21:42:31.539(2)? (STDERR)     at fileEvaluate (packages/modules-runtime.js:339:7)
W20180623-21:42:31.539(2)? (STDERR)     at require (packages/modules-runtime.js:238:16)
W20180623-21:42:31.539(2)? (STDERR)     at main.js (server/main.js:1:88)
W20180623-21:42:31.539(2)? (STDERR)     at fileEvaluate (packages/modules-runtime.js:339:7)
W20180623-21:42:31.539(2)? (STDERR)     at require (packages/modules-runtime.js:238:16)
W20180623-21:42:31.539(2)? (STDERR)     at /Users/mhe/projects/iambossy/.meteor/local/build/programs/server/app/app.js:236:15
W20180623-21:42:31.539(2)? (STDERR)     at /Users/mhe/projects/iambossy/.meteor/local/build/programs/server/boot.js:411:36

Я добавил упрощенную схему и aldeed: collection2@3.0.0

meteor add aldeed: collection2@3.0.0

установить метеор в минуту - сохранить упрощенную схему

...