I have two sections on my page.
The first section has a limited list of items. The Second section has a total count of items (recordsCount).
When a server adds a new item I see the list of items is updated but the total count has an old value.
Tracks = new Mongo.Collection('tracks')
Client:
Meteor.subscribe('tracks')
Meteor.call('records', function(err, data) {
Session.set('_records', data)
})
Template.tracks.helpers({
tracks: function() {
return Tracks.find()
},
recordsCount: function() {
return Session.get('_records')
}
})
Server:
Meteor.publish('tracks', function() {
return Tracks.find({}, {limit: 100})
})
Meteor.methods({
records: function() {
return Tracks.find({}).count()
}
})
var CronManager = new Cron(10000)
CronManager.addJob(1, function() {
Tracks.insert({filed1: 'test'})
})