I'm trying to build an active/inactive indicator into a chat application in Meteor. To do that, I need to keep track of the time of each user's most recent activity on every client. Whenever a user sends a message, this line is called:
People.update({ name: login }, { $set: { activity: new Date() }});
I can see the data changing in the database with the meteor mongo
command. In another part of the file, I have some code that looks like this:
Template.user_listing.people = function () {
return People.find();
}
In my code, this function only gets called when items are added to or removed from the People collection. The first code example, People.update(...)
, doesn't trigger a reaction, and I was under the impression that it should. What am I doing wrong?