我实际上是在尝试将一些数组放入一个集合中,这将是另一个集合的文档获取。也许,实际上,我在控制台中得到了追溯。
我不知道为什么,它似乎无法加载收集数据。
此刻,我试图使用find和fetch方法加载收集数据,以获得一个数组。也许,这告诉我该集合未定义。
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import SimpleSchema from 'simpl-schema';
SimpleSchema.extendOptions(['autoform']);
Project = new Mongo.Collection('project');
Project.allow({
insert: function(userId, doc) {
return !!userId;
},
update: function (userId, doc) {
return !!userId;
},
});
// LOAD HERE OTHE COLLECTIONS
partnersLoad = Partners.find({}).fetch();
Project_Schema = new SimpleSchema ({
name: {
type: String,
label: "Name *"
},
subtitle: {
type: String,
label: "Subtitle *"
},
desc: {
type: String,
label: "Description",
optional: true
},
client: {
type: Array,
optional: true
},
"client.$": {
type: String,
label: "Client name",
allowedValues: Partners
},
///...///
});
Meteor.methods({
projectDelete: function(id) {
Project.remove(id)
},
});
Project.attachSchema(Project_Schema);
我在这里还有另一个收藏Juste:
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import SimpleSchema from 'simpl-schema';
SimpleSchema.extendOptions(['autoform']);
Partners = new Mongo.Collection('Partners');
Partners.allow({
insert: function(userId, doc) {
return !!userId;
}
});
PartnersSchema = new SimpleSchema ({
name: {
type: String,
label: "Partner name"
},
surname: {
type: String,
label: "Partner surname"
}
});
Meteor.methods({
partnersDeletePartners: function(id) {
Partners.remove(id)
},
});
Partners.attachSchema(PartnersSchema);
他们俩都在atm(CRUD操作)上工作,也许我找不到我的合作伙伴...
这是控制台中的错误:
=> Exited with code: 1
W20190131-18:01:50.042(1)? (STDERR) /Users/vincentcoffin/.meteor/packages/promise/.0.11.1.gy8c7h.yyj0f++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/meteor-promise/promise_server.js:218
W20190131-18:01:50.043(1)? (STDERR) throw error;
W20190131-18:01:50.043(1)? (STDERR) ^
W20190131-18:01:50.043(1)? (STDERR)
W20190131-18:01:50.043(1)? (STDERR) ReferenceError: Partners is not defined
W20190131-18:01:50.043(1)? (STDERR) at collection.js (collections/standard/project/collection.js:20:1)
W20190131-18:01:50.043(1)? (STDERR) at fileEvaluate (packages/modules-runtime.js:336:7)
W20190131-18:01:50.044(1)? (STDERR) at Module.require (packages/modules-runtime.js:238:14)
W20190131-18:01:50.044(1)? (STDERR) at Module.moduleLink [as link] (/Users/vincentcoffin/.meteor/packages/modules/.0.13.0.isz01z.tqm6k++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/reify/lib/runtime/index.js:38:38)
谢谢大家的支持,无论如何都祝您编程愉快!