Transform Collection on the client side

Basically, I am trying to get helper functions on all Collections on the client side. I tried using _transform on the Collection declaration, only shows on the server side. I tried using meteor-collection-helpers and meteor-models packages, neither of which gave me any results. Any suggestions?

Also, I NEED functions on this, I think that is where my issue is. Basically, I need some method where I could modify a document as it comes to the client and all calls to that document later on will have the functions I gave it.

Pass the transform (not _transform) option when you create the collection. See

1 Like

Thanks for the response. I do have to use _transform from the Meteor.users object though correct? Or is there a more proper method of doing this.

Also, using this method I don’t get to have functions attached to the Collection still? I do a console.log and any variable I attached gets passed just fine, but any functions seem to be stripped. Right now I’m just reworking my logic to work without requiring those functions, but it’d be nice instead of pre-computing stuff I might not use.

Thanks again for the fast response!

Here you go. This is how I have done it in my last project:

// User model
User = function (data) {
  _.extend(this, data);

_.extend(User.prototype, {
  getRole: function () {
    return this.role;
  // TODO: More methods

// Transform
Meteor.users._transform = function (user) {
  return new User(user);