@@ -104,17 +104,15 @@ constructor, as shown below:
104
104
Upload Files
105
105
------------
106
106
107
- Use the ``upload_from_stream ()`` method from the ``GridFSBucket`` class to upload
108
- a file to a GridFS bucket. Pass the following parameters to the ``upload_from_stream ()``
107
+ Use the ``open_upload_stream ()`` method from the ``GridFSBucket`` class to upload
108
+ a file to a GridFS bucket. Pass the following parameters to the ``open_upload_stream ()``
109
109
method:
110
110
111
- - ``filename``: The name of the file to store the uploaded content
112
- - ``source``: The file you want to upload
113
- - ``chunk_size_bytes``: The number of bytes per chunk of this file (optional).
114
- - ``metadata``: The file metadata (optional).
111
+ - ``filename``: The name of the file you want to upload
112
+ - ``chunk_size_bytes``: The number of bytes per chunk of this file (optional)
113
+ - ``metadata``: The file metadata (optional)
115
114
116
- The following code example uploads a file located at ``./file_to_upload`` and stores
117
- its contents in ``my_file``:
115
+ The following code example uploads a file named ``"my_file"`` to a GridFS bucket:
118
116
119
117
.. literalinclude:: /includes/gridfs/gridfs.py
120
118
:language: python
@@ -163,11 +161,11 @@ Download Files
163
161
--------------
164
162
165
163
You can download files from your MongoDB database by using the
166
- ``download_to_stream_by_name ()`` method from the ``GridFSBucket``
164
+ ``open_download_stream_by_name ()`` method from the ``GridFSBucket``
167
165
class.
168
166
169
167
The following example shows you how to download a file referenced
170
- by the file name, ``my_file``, into a file named ``output_file`` :
168
+ by the file name, ``" my_file" ``, and read its contents :
171
169
172
170
.. literalinclude:: /includes/gridfs/gridfs.py
173
171
:language: python
@@ -181,7 +179,7 @@ by the file name, ``my_file``, into a file named ``output_file``:
181
179
GridFS will stream the most recent file with the given name (as
182
180
determined by the ``uploadDate`` field).
183
181
184
- Alternatively, you can use the ``download_to_stream ()``
182
+ Alternatively, you can use the ``open_download_stream ()``
185
183
method, which takes the ``_id`` field of a file as a parameter:
186
184
187
185
.. literalinclude:: /includes/gridfs/gridfs.py
0 commit comments