Notifications = new Meteor.Collection('notifications'); // Notifications = new Meteor.Collection("notifications", { // schema: new SimpleSchema({ // properties: { // type: Object // }, // event: { // type: String // }, // read: { // type: Boolean // }, // createdAt: { // type: Date // }, // userId: { // type: "???" // } // }) // }); Notifications.allow({ insert: function(userId, doc){ // new notifications can only be created via a Meteor method return false; } , update: canEditById , remove: canEditById }); buildSiteNotification = function(notification){ var event = notification.event, p = notification.properties, userToNotify = Meteor.users.findOne(notification.userId), html switch(event){ case 'newReply': html = '

'+p.commentAuthorName+' has replied to your comment on "'+p.postTitle+'"

'; break; case 'newComment': html = '

'+p.commentAuthorName+' left a new comment on your post "'+p.postTitle+'"

'; break; default: break; } return html; }; Meteor.methods({ markAllNotificationsAsRead: function() { Notifications.update( {userId: Meteor.userId()}, { $set:{ read: true } }, {multi: true} ); } });