Skip to content

Commit 69cb607

Browse files
committed
gridfs examples
1 parent 3b9ce40 commit 69cb607

File tree

2 files changed

+4
-24
lines changed

2 files changed

+4
-24
lines changed

source/includes/usage-examples/write-code-examples.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,9 @@
107107
);
108108
// end-bulk-write
109109

110-
// Creates a GridFS bucket or references an existing one
111-
// start-gridfs-bucket
112-
$bucket = $client->selectDatabase('<database name>')->selectGridFSBucket();
113-
// end-gridfs-bucket
114-
115110
// Stores a file in a GridFS bucket and writes data to the file
116111
// start-gridfs-upload
112+
$bucket = $client->selectDatabase('<database name>')->selectGridFSBucket();
117113
$stream = $bucket->openUploadStream('<file name>');
118114
fwrite($stream, '<data>');
119115
fclose($stream);

source/write.txt

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -171,23 +171,8 @@ operation:
171171
To learn more about the ``MongoDB\Collection::bulkWrite()`` method, see the
172172
:ref:`Bulk Write <php-bulk-write>` guide.
173173

174-
Create a GridFS Bucket
175-
----------------------
176-
177-
The following code shows how to create or reference a GridFS bucket, which
178-
you can write large files to:
179-
180-
.. literalinclude:: /includes/usage-examples/write-code-examples.php
181-
:start-after: start-gridfs-bucket
182-
:end-before: end-gridfs-bucket
183-
:language: php
184-
:dedent:
185-
186-
To learn more about the ``MongoDB\Database::selectGridFSBucket()`` method, see the
187-
:ref:`Store Large Files <php-gridfs>` guide.
188-
189-
Store GridFS Files
190-
------------------
174+
Store Large Files
175+
-----------------
191176

192177
The following code shows how to store files in a GridFS bucket by
193178
creating an upload stream:
@@ -198,5 +183,4 @@ creating an upload stream:
198183
:language: php
199184
:dedent:
200185

201-
To learn more about the ``MongoDB\GridFS\Bucket::openUploadStream()`` method, see the
202-
:ref:`Store Large Files <php-gridfs>` guide.
186+
To learn more about GridFS, see the :ref:`Store Large Files <php-gridfs>` guide.

0 commit comments

Comments
 (0)