Reputation: 345
I've created a new collection (Areas) through the shell but for some reason when I try to publish it :
Meteor.publish('Areas', function(){
return Meteor.Areas.find();
});
I get the following error: Exception from sub Areas id vSLHezdCrv77i6aca TypeError: Cannot call method 'find' of undefined.
I use exactly the same process for the users table and it works fine. When I query it from the mongo shell it's also okay.
Any help would be greatly appreciated!
EDIT:
Code for subscribe:
Template.content_profile.onCreated(function() {
var self = this;
self.autorun(function() {
var id = FlowRouter.getParam('id');
self.subscribe('profileInfo', id);
self.subscribe('Areas');
});
console.log(Areas.find().count());
});"
Upvotes: 0
Views: 453
Reputation: 4049
You don't have to prefix it with Meteor:
Areas = new Mongo.Collection("areas");
Meteor.publish('Areas', function(){
return Areas.find();
});
Upvotes: 1