我尝试使用Meteor的pubsub模式但我的出版物正在false
上返回ready()
。这似乎有点异常,互联网上没有这类问题 - 这可能意味着我错过了一些基本的东西,无论如何我们走了:
// in /app/server/collections/clubs.js
import ClubSchema from '../schemas/clubs.js';
export const Clubs = ( function() { // <- tried refactoring to
var clubs = new Mongo.Collection('clubs'); // standard collection declaration
clubs.attachSchema(ClubSchema);
return clubs;
} )();
// in /app/server/publications/clubs.js
import { Clubs } from '/app/server/collections/clubs.js';
Meteor.publish('clubs', function () {
console.log("hello, world!");
return Clubs.find();
});
// in /app/client/templates/new-club.js
Template.App_clubs.onCreated(function () {
Meteor.subscribe('clubs');
});