I’m a bit stumped on this and I’m not really seeing where the problem lies. First I thought it was something on the directory structure… but, no. This is on Meteor beta.8, by the way.
I first stumbled across this when I wanted to publish all users to the admin for an admin panel. I noticed that the collection on the client side remained empty. First I though it was the alanning:roles package but that one seems to be innocent.
The code in question on a shared file:
AllUsers = new Mongo.Collection("allusers");
Test = new Mongo.Collection("test");
console.log("Shared");
if(Meteor.isServer) {
console.log("Server");
Meteor.publish("allusers", function() {
console.log("Test");
return Meteor.users.find({});
});
Meteor.publish("test", function(){
console.log("Test2");
return Test.find({});
});
}
I think maybe you are confusing things. Do you believe that Meteor.publish() publishes into a collection? I mean, I guess in a certain way it is, but when you create the collection ‘allUsers’ it references a collection in the database and when you publish ‘allUsers’ it is just a reference to the cursor holding the query you executed.