Commit 1be388e0 authored by Jeremy Mikola's avatar Jeremy Mikola

Fix GridFS tutorial examples to read a stream's contents

parent df57d682
...@@ -87,7 +87,7 @@ To open a download stream and read from it: ...@@ -87,7 +87,7 @@ To open a download stream and read from it:
$bucket = (new MongoDB\Client)->example->selectGridFSBucket(); $bucket = (new MongoDB\Client)->example->selectGridFSBucket();
$stream = $bucket->openDownloadStream($fileId); $stream = $bucket->openDownloadStream($fileId);
$contents = file_get_contents($stream); $contents = stream_get_contents($stream);
To download the file all at once and write it to an writable stream: To download the file all at once and write it to an writable stream:
...@@ -136,7 +136,7 @@ particular file: ...@@ -136,7 +136,7 @@ particular file:
$bucket = (new MongoDB\Client)->example->selectGridFSBucket(); $bucket = (new MongoDB\Client)->example->selectGridFSBucket();
$stream = $bucket->openDownloadStreamByName('my-file.txt', ['revision' => 0]); $stream = $bucket->openDownloadStreamByName('my-file.txt', ['revision' => 0]);
$contents = file_get_contents($stream); $contents = stream_get_contents($stream);
Deleting Files Deleting Files
-------------- --------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment