Reputation: 3551
I've got a fairly simple Meteor app with:
lib/collections.js
var Meetings = new Meteor.Collection('meetings');
and server/publications.js:
Meteor.publish("meetings", function () {
return Meetings.find({"participants":this.userId});
});
This was working, I think, but now sometimes I get:
Exception from sub vvpqwiujATG49puAc ReferenceError: Meetings is not defined
at [object Object]._handler (app/server/publications.js:2:10)
I feel like this is an order of operations problem but my understanding is that lib/ should always run first?
Upvotes: 2
Views: 574
Reputation: 64312
I'll award you partial credit for getting the collection defined under lib
so it will be loaded before the publisher, however in order for the Meetings
variable to be visible between files it will need to be declared globally. Remove the var
before Meetings
and you should be all set.
Upvotes: 2