Meteor.publish('polls', function () {
return Polls.find({});
});
Meteor.publish('recentPolls', function() {
return Polls.find({}, {sort: {date: -1}, limit: 10}).fetch();
});
So this is in my /server/server.js
file from the documentation it says the fetch()
method returns matched documents in an array. However, using the subscribe function in the client like so
Template.recentPolls.polls = function() {
console.log(Meteor.subscribe('recentPolls'));
return Meteor.subscribe('recentPolls');
}
For some odd reason this is returning the following object (not an array) but an object
Object {stop: function, ready: function}
And this is the error I get in the console.
Exception from sub 5NozeQwianv2DL2eo Error: Publish function returned an array of non-Cursors