I've a simple meteor application I made for learning how to do CRUD operations. It works great but I'm having issues with the publish/subscribe of my collection and I can't for the life of me figure it out.
My folder structure is
/client
/main.js
/templates
/public
/server
/main.js
I've a main.js file in server folder with basic collection with a publish feature
/server/main.js
Dist = new Mongo.Collection('dist');
Meteor.publish('dist', function (){
var currentUser = this.userId;
return Dist.find({owner: currentUser});
});
and under client folder a subscribe
/client/main.js
Meteor.subscribe('dist');
I've a for each loop in a template that is suppose to show the returned info for the user. When my servers main.js is in the server folder my template loop returns nothing but CRUD calls back to the server work fine. If I move the server main.js file into the root of my project everything works as intended. However, doesn't this defeat the purpose of publish/subscribe aspect: keeping the main collection on the server side while showing users only their own data from it?
I can't figure out why this is happening after endless Google searches nothing seems to make a difference. Auto publish and insecure have been removed as well. The only third party package I believe is bootstrap for styling.