New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No way to edit meta data or otherwise modify GridFS entries without re-uploading #332
Comments
As for Would a helper method on the Bucket suffice? For example:
|
Yeah that'd be fine. It's six of one half a dozen of the other, really. |
I opened PHPLIB-258 to track the addition of accessor methods for the files and chunks collections. The feature is slated for 1.2.0. Feel free to follow that issue for updates. |
Accessor methods have been implemented in #407, which will make it into the upcoming 1.2.0 release. |
A simple use case we have for this is where a user uploads an avatar image but it requires moderator approval before it can be used, and we have a tool that does a simple
['$set' => ["metadata.approved" => true/false]]
. To locally work around this, I've simply added anupdateOne
method toMongoDB\GridFS\Bucket
andMongoDB\GridFS\CollectionWrapper
to let us do arbitrary updates.I don't really have a recommendation on what the official interface for this would be, as it seems you've intended for a limited number of ways to manipulate a GridFS entry but at the same time I don't think a straight up "setMetadata" would be sufficient, as I may want to conditionally update a single property etc. etc.
The text was updated successfully, but these errors were encountered: