Why are mine collections undefined when I’m using the pub/sub model to get collections:
On my server.js file:
images = new Mongo.Collection("images");
images.deny({
insert() { return true; },
update() { return true; },
remove() { return true; }
});
Meteor.publish("images", function (limit) {
if (this.userId) {
return images.find({user:{$ne:this.userId}}, {sort:{createdAt:-1}},{limit:limit});
}else{
this.ready();
}
});
On my client.js file:
var handle;
Deps.autorun(function(){
handle = Meteor.subscribeWithPagination("images", 2);
});
Template.myHome.helpers({
userImgs: function(){
var userID = Meteor.user()._id;
usersImages = new ReactiveVar(images.find({_id:{$ne: userID}},{ImagesUploaded: {$elemMatch: {editStatus:true}}}).fetch());
}
});
This gives me the error on my client:
Exception in template helper: ReferenceError: images is not defined
Why does it give this error?
Thanks