下面這是我收集的代碼流星的pub/sub問題
Competitions = new Mongo.Collection("competitions");
var CompetitionsSchema = new SimpleSchema({
year: {
type: String
},
division: {
type : String,
allowedValues: ['Elite', '1st','2nd','3rd','4th','Intro']
},
teams:{
type : [TeamSchema],
allowedValues: (function() {
return Teams.find().fetch().map(function (doc) {
return doc.name;
});
}()) //here we wrap the function as expression and invoke it
}
});
在ALLOWEDVALUES功能
Teams.find是空的。
在我訂閱的刊物如下
this.route('competitions', {
path: '/admin/competitions',
layoutTemplate: 'adminLayout',
waitOn: function() {
return [
Meteor.subscribe('teams')
];
}
});
這是我發佈功能的路由器
Meteor.publish('teams', function() {
return Teams.find({},{sort: {
points: -1,
netRunRate : -1
}});
});
我必須做一些訂閱還有什麼地方呢?
你的發佈函數是什麼樣的? –
只需更新我的問題。 – mohsinali1317