Skip to content

Commit

Permalink
Limit fields for cursors for finer reactivity #2
Browse files Browse the repository at this point in the history
  • Loading branch information
erasaur committed May 2, 2015
1 parent b50d563 commit bcb1d56
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions client/views/notifications/notifications.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
Template.notifications.helpers({
hasNotifications: function () {
return !!Herald.collection.find({ 'userId': Meteor.userId() }, {
sort: { timestamp: -1 }
fields: { '_id': 1 }, sort: { 'timestamp': -1 }
}).count();
},
notifications: function () {
return Herald.collection.find({ 'userId': Meteor.userId() }, {
sort: { timestamp: -1 }
sort: { 'timestamp': -1 }
});
},
notificationCount: function () {
return Herald.collection.find({ 'userId': Meteor.userId(), 'read': false }).count();
return Herald.collection.find({ 'userId': Meteor.userId(), 'read': false }, {
fields: { 'read': 1 }
}).count();
}
});

0 comments on commit bcb1d56

Please sign in to comment.