-
-
Notifications
You must be signed in to change notification settings - Fork 514
Open
Labels
Description
(originally reported as https://jira.mongodb.org/browse/PHPLIB-486)
When using DefaultGridFSRepository::uploadFromStream, the repository class runs a proxy object for the GridFS file with the ID returned from MongoDB\GridFS\Bucket::uploadFromStream. This results in a database query when accessing the file proxy, which is unnecessary as the stream wrappers keep a copy of the document in memory.
This extra query can be avoided by not using the uploadFromStream and uploadFromFile methods, but rather using openUploadStream and stream_copy_to_stream in conjunction with Bucket::getFileDocumentForStream to return the actual document instead of a proxy.
Frederick888