Meteor-CollectionFS icon indicating copy to clipboard operation
Meteor-CollectionFS copied to clipboard

FS.File.copy should allow modifying objects before saving

Open lukejagodzinski opened this issue 10 years ago • 8 comments
trafficstars

It should be possible to pass Mongo Modifier as a parameter of FS.File.copy function to alter object just before saving it. The other solution could be one proposed by @aldeed that it could by just function that will be invoked before saving.

lukejagodzinski avatar Dec 15 '14 15:12 lukejagodzinski

Hi folks, just wondering if there was any progress on this? If it's not possible to change the meta data before the copy, what's the best approach to modify it afterwards, pls? ie do I do the copy and then call some update function or just a straight mongodb update?

adamgins avatar Apr 12 '15 20:04 adamgins

@adamgins I know this is kind of a late response, but I just encountered this and figured I would say what I was doing, figuring if anyone sees this and lets me know I did it wrong, it could help out people in the future. My code looks a bit like this:

let newFile = original.copy();  

newFile.update({
  '$set': {
    'owner': Meteor.userId()
  }
});

I am doing this on the server, and it appears to work as intended.

CoolestNerdIII avatar Jul 13 '16 04:07 CoolestNerdIII

@CoolestNerdIII cheers. I am not using CollectionFS any longer.. especially as it now has the "deprecated" tag

adamgins avatar Jul 13 '16 04:07 adamgins

Yeah I have been looking for another solution to migrate to. What do you use now if you don''t mind my asking?

CoolestNerdIII avatar Jul 13 '16 04:07 CoolestNerdIII

I ended going commercial filestack.com , I use it for www.buzzy.buzz I did look at Slingshot https://github.com/CulturalMe/meteor-slingshot/ but needs some features that were not available.

adamgins avatar Jul 13 '16 04:07 adamgins

Thanks I will check those out. Kinda wish this wasn't deprecated. Oh well

CoolestNerdIII avatar Jul 13 '16 04:07 CoolestNerdIII

yeah, I wish Meteor JS has had a set of core services for files, editors etc as part of the platform/framework. I know this is highly dependent on the UX approach chosen by each developer, but would be nice to have some core services that almost every app needs.

adamgins avatar Jul 13 '16 04:07 adamgins

I agree 100%. I am looking currently at https://github.com/VeliovGroup/Meteor-Files but I kind of don't want to refactor all of my code at the moment.

CoolestNerdIII avatar Jul 13 '16 04:07 CoolestNerdIII