Some of my collections are declared like this
export default Foos = new Meteor.Collection('foo', {
transform(foo) {
foo.someMethod = someMethod;
return foo;
}
});
How do I apply a transformation function to the Meteor.users
collection?
Update
My hack, currently, is to manually set it.
Meteor.users._transform = function (user) { ... return user; }
Seems to work.
I see you already figured out how to add the
transform
function, but there is one more thing you should do. That is to wrap your function withLocalCollection.wrapTransform
prior to assigning it to_transform
:Doing this will make sure the returned objects contain the
_id
field so that subsystems can keep track of the objects identities. Also you need to addminimongo
to your project to use this wrap function.