【发布时间】:2014-04-02 21:56:00
【问题描述】:
Meteor.publish('polls', function () {
return Polls.find({});
});
Meteor.publish('recentPolls', function() {
return Polls.find({}, {sort: {date: -1}, limit: 10}).fetch();
});
所以这是在我的文档中的/server/server.js 文件中,它说fetch() 方法在数组中返回匹配的文档。但是,像这样在客户端使用订阅功能
Template.recentPolls.polls = function() {
console.log(Meteor.subscribe('recentPolls'));
return Meteor.subscribe('recentPolls');
}
出于某种奇怪的原因,这将返回以下对象(不是数组)而是一个对象
Object {stop: function, ready: function}
这是我在控制台中遇到的错误。
Exception from sub 5NozeQwianv2DL2eo Error: Publish function returned an array of non-Cursors
【问题讨论】: