I have done a Simple Publish/subscribe in my meteor project and whenever User lands on home page I have to show count of total users. Users are around 15000. Now in template helper I have code written a code as,
CLIENT-SIDE
Template.voters.helpers({
voters : function() {
return voters.find({});
},
count : voterscount
});
then on SERVER-SIDE
voters = new Mongo.Collection("voters");
voterscount = function() {
return voters.find({}).count();
}
Meteor.publish('voters', function() {
return voters.find({});
});
Meteor.publish('voterscount', function() {
return voterscount;
});
- The output that I receive is that the count starts from 0 to 15000 on UI Which is irritating.
- I don't want rolling up of the digits on UI and should show the static count on UI as 15000 whenever page refreshed.
- Why is this so slow it. In production i will have around 10 million documents in collection. This is big drawback. Any help, please?