Collection subscribtion, not what I thought

Why does Meteor say I have 3 items in the Rostas collection when Ive asked my publish class to publish a single “row”?

publications.js //on server

Meteor.publish(‘getRostaById’, function(rostaId){
console.log('Server pub: ’ + rostaId);
if(rostaId) {
let Obj = Rostas.find({_id: rostaId});
console.log(Obj.count());//prints 1
return Obj;
}
});

//Client
View Template
Template.viewRosta.onCreated(function() {
let rostaId = FlowRouter.current().params.id;
Meteor.subscribe(‘getRostaById’, rostaId);
console.log(Rostas.find({}).count());//prints 3 entries??
});

helpers {
getTeamMembers: function() {
let rosta = Rostas.find({}).fetch();
etc, etc
return ‘testing’
}

Did you remove the autopublish package? Any other publications for this collection?

Yes I always remove the autopublish package. However Ive had a light bulb moment, I was subscribing to all Rostas from the home page, thats why I always had the full collection published to minimongo. I guess this is a pretty typical gotcha for newbies.

Do I need to mark this as solved?

That feature isn’t enabled currently. You can just add [Solved] to the beginning of the title for now :slight_smile: