publications.js 475 B

12345678910111213141516171819202122
  1. Meteor.publish('posts', function (options) {
  2. // It would probably be safe to pass sort and limit as 2 separate params.
  3. check(options, {
  4. sort: Object,
  5. limit: Number
  6. });
  7. return Posts.find({}, options);
  8. });
  9. Meteor.publish('comments', function (postId) {
  10. check(postId, String);
  11. return Comments.find({
  12. postId: postId
  13. });
  14. });
  15. Meteor.publish('notifications', function () {
  16. return Notifications.find({
  17. userId: this.userId,
  18. read: false
  19. });
  20. });