nmacmunn / meteor-censor

A Meteor package that lets you transform published documents

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

meteor-censor

Offers an easy way to denormalize published documents, as described in the excellent article Reactive Joins in Meteor

Usage

Works the same as Meteor.publish, except the transform option is respected (if provided).

Meteor.censor(name, func);

Example

Return a set of user docs joined with the corresponding users' avatars.

Meteor.censor("users", function () {
  return Meteor.users.find({}, {
    transform: function (user) {
      user.avatar = images.findOne({owner: user._id});
      return user;
    }
  });
});

About

A Meteor package that lets you transform published documents


Languages

Language:JavaScript 100.0%