Reputation: 303
I have a publications.js file that ONLY includes
Meteor.publish('org', function(_id){
return Organizations.findOne(_id);
});
When things render I get this in the console:
Uncaught TypeError: Meteor.publish is not a function
What am I missing here... I'm sure it's painfully obvious.
Upvotes: 7
Views: 4865
Reputation: 64312
You are probably accidentally running the code on the client. You have two choices:
/server
directory in your app.if (Meteor.isServer) {}
block.(1) Has the advantage of not transmitting the publish code to the client.
Suggested reading: Structuring your application.
Upvotes: 16
Reputation: 10372
If the file is at the root, you need to wrap it with:
if ( Meteor.isServer ) {
/* ... */
}
The Meteor.publish
method only exists on the server.
Upvotes: 1