流星发布。已经返回虚假

时间:2017-09-18 18:51:25

标签: javascript meteor

我尝试使用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');
});

0 个答案:

没有答案