Skip to content

Commit 42c5df8

Browse files
committed
GridFS docs fixes.
1 parent cdb40fb commit 42c5df8

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

gridfs/__init__.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -609,8 +609,9 @@ def download_to_stream(self, file_id, destination):
609609
# Get _id of file to read
610610
file_id = fs.upload_from_stream("test_file", "data I want to store!")
611611
# Get file to write to
612-
file = open('myfile','rwb')
612+
file = open('myfile','wb+')
613613
fs.download_to_stream(file_id, file)
614+
file.seek(0)
614615
contents = file.read()
615616
616617
Raises :exc:`~gridfs.errors.NoFile` if no file with file_id exists.
@@ -715,12 +716,13 @@ def open_download_stream_by_name(self, filename, revision=-1):
715716
Defaults to -1 (the most recent revision).
716717
717718
:Note: Revision numbers are defined as follows:
718-
0 = the original stored file
719-
1 = the first revision
720-
2 = the second revision
721-
etc...
722-
-2 = the second most recent revision
723-
-1 = the most recent revision
719+
720+
- 0 = the original stored file
721+
- 1 = the first revision
722+
- 2 = the second revision
723+
- etc...
724+
- -2 = the second most recent revision
725+
- -1 = the most recent revision
724726
"""
725727
validate_string("filename", filename)
726728

@@ -764,12 +766,13 @@ def download_to_stream_by_name(self, filename, destination, revision=-1):
764766
Defaults to -1 (the most recent revision).
765767
766768
:Note: Revision numbers are defined as follows:
767-
0 = the original stored file
768-
1 = the first revision
769-
2 = the second revision
770-
etc...
771-
-2 = the second most recent revision
772-
-1 = the most recent revision
769+
770+
- 0 = the original stored file
771+
- 1 = the first revision
772+
- 2 = the second revision
773+
- etc...
774+
- -2 = the second most recent revision
775+
- -1 = the most recent revision
773776
"""
774777
gout = self.open_download_stream_by_name(filename, revision)
775778
for chunk in gout:

0 commit comments

Comments
 (0)