@@ -83,7 +83,7 @@ call read and write operations on the files in your bucket.
8383
8484.. literalinclude:: /includes/gridfs/gridfs.py
8585 :language: python
86- :copyable: true
86+ :dedent:
8787 :start-after: start create bucket
8888 :end-before: end create bucket
8989
@@ -95,7 +95,7 @@ constructor, as shown below:
9595
9696.. literalinclude:: /includes/gridfs/gridfs.py
9797 :language: python
98- :copyable: true
98+ :dedent:
9999 :start-after: start create custom bucket
100100 :end-before: end create custom bucket
101101
@@ -104,16 +104,16 @@ constructor, as shown below:
104104Upload Files
105105------------
106106
107- Use the ``open_upload_stream()`` method from the ``GridFSBucket`` class to create an upload
108- stream for a given file name. The
109- ``open_upload_stream()`` method allows you to specify configuration information
110- such as file chunk size and other field/value pairs to store as metadata. Set
111- these options as parameters of ``open_upload_stream()``, as shown in the
112- following code example:
107+ Use the ``open_upload_stream()`` method from the ``GridFSBucket`` class to
108+ create an upload stream for a given file name. The ``open_upload_stream()``
109+ method allows you to specify configuration information such as file chunk
110+ size and other field/value pairs to store as metadata. Set these options
111+ as parameters of ``open_upload_stream()``, as shown in the following code
112+ example:
113113
114114.. literalinclude:: /includes/gridfs/gridfs.py
115115 :language: python
116- :copyable: true
116+ :dedent:
117117 :start-after: start upload files
118118 :end-before: end upload files
119119
@@ -138,12 +138,12 @@ from which you can access the results. To learn more about ``Cursor`` objects in
138138{+driver-short+}, see :ref:`<pymongo-cursors>`.
139139
140140The following code example shows you how to retrieve and print file metadata
141- from all your files in a GridFS bucket. It uses the ``for...of `` syntax to traverse the
141+ from all your files in a GridFS bucket. It uses the ``for...in `` syntax to traverse the
142142``Cursor`` iterable and display the results:
143143
144144.. literalinclude:: /includes/gridfs/gridfs.py
145145 :language: python
146- :copyable: true
146+ :dedent:
147147 :start-after: start retrieve file info
148148 :end-before: end retrieve file info
149149
@@ -162,12 +162,11 @@ You can download files from your MongoDB database by using the
162162download stream.
163163
164164The following example shows you how to download a file referenced
165- by the file name, stored in the ``filename`` field, into your working
166- directory:
165+ by the file name, ``"my_file"``, and read its contents:
167166
168167.. literalinclude:: /includes/gridfs/gridfs.py
169168 :language: python
170- :copyable: true
169+ :dedent:
171170 :start-after: start download files name
172171 :end-before: end download files name
173172
@@ -182,7 +181,7 @@ method, which takes the ``_id`` field of a file as a parameter:
182181
183182.. literalinclude:: /includes/gridfs/gridfs.py
184183 :language: python
185- :copyable: true
184+ :dedent:
186185 :start-after: start download files id
187186 :end-before: end download files id
188187
@@ -204,11 +203,11 @@ bucket. You must specify the file to rename by its ``_id`` field
204203rather than its file name.
205204
206205The following example shows how to update the ``filename`` field to
207- ``"newFileName "`` by referencing a document's ``_id`` field:
206+ ``"new_file_name "`` by referencing a document's ``_id`` field:
208207
209208.. literalinclude:: /includes/gridfs/gridfs.py
210209 :language: python
211- :copyable: true
210+ :dedent:
212211 :start-after: start rename files
213212 :end-before: end rename files
214213
@@ -233,7 +232,7 @@ The following example shows you how to delete a file by referencing its ``_id``
233232
234233.. literalinclude:: /includes/gridfs/gridfs.py
235234 :language: python
236- :copyable: true
235+ :dedent:
237236 :start-after: start delete files
238237 :end-before: end delete files
239238
0 commit comments