Meteor-CollectionFS
Meteor-CollectionFS copied to clipboard
FS.File.copy should allow modifying objects before saving
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.
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 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 cheers. I am not using CollectionFS any longer.. especially as it now has the "deprecated" tag
Yeah I have been looking for another solution to migrate to. What do you use now if you don''t mind my asking?
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.
Thanks I will check those out. Kinda wish this wasn't deprecated. Oh well
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.
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.