dburles / meteor-collection-helpers

⚙️ Meteor package that allows you to define helpers on your collections
https://atmospherejs.com/dburles/collection-helpers
MIT License
498 stars 31 forks source link

Can't use collection helper on FS.Collection. #52

Closed zayau closed 8 years ago

zayau commented 8 years ago

Say Photos is a FS.Collection. And when you do Photos.files.helpers({...}); you get Error: [Can't apply helpers to 'cfs.photos.filerecord' a transform function already exists!] error message. CollectionFS doc says underlying Mongo.Collection instance available through myFSCollection.files.

dburles commented 8 years ago

Hey @zayaisshawn just as the error states, there's already a transform function defined for that collection. Perhaps collectionfs has already created one? I don't have any experience using that package, maybe it has its own way for you to add methods to the transform function it has setup. Have you opened an issue over there?

zayau commented 8 years ago

Hi @dburles I have not opened an issue there. Yes, it turns out FS.Collection has its own transform function created. In my understanding, It is different from normal transform function you use on any mongo.collection. I have not found the answer to this problem yet. However, since I use reywood:publish-composite, it's easier to just publish related cursor and use template helper. Someone on stackoverflow suggested to define custom function on fs.collection prototype. I lack experience to do that but I will look further into that later. Thank you.

dburles commented 8 years ago

Hey thanks @zayaisshawn if you do find how to work around the incompatibility I'd appreciate it if you would let me know

dburles commented 8 years ago

collectionFS could add support for this package

zayau commented 8 years ago

True. If there is no pull request already, I'll add one.