From 42c5df83fbd30e6e8a188d48b2eb35659fbce861 Mon Sep 17 00:00:00 2001 From: "A. Jesse Jiryu Davis" Date: Sun, 30 Oct 2016 20:59:58 -0400 Subject: [PATCH] GridFS docs fixes. --- gridfs/__init__.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/gridfs/__init__.py b/gridfs/__init__.py index 09238873b..8b13e0cb8 100644 --- a/gridfs/__init__.py +++ b/gridfs/__init__.py @@ -609,8 +609,9 @@ class GridFSBucket(object): # Get _id of file to read file_id = fs.upload_from_stream("test_file", "data I want to store!") # Get file to write to - file = open('myfile','rwb') + file = open('myfile','wb+') fs.download_to_stream(file_id, file) + file.seek(0) contents = file.read() Raises :exc:`~gridfs.errors.NoFile` if no file with file_id exists. @@ -715,12 +716,13 @@ class GridFSBucket(object): Defaults to -1 (the most recent revision). :Note: Revision numbers are defined as follows: - 0 = the original stored file - 1 = the first revision - 2 = the second revision - etc... - -2 = the second most recent revision - -1 = the most recent revision + + - 0 = the original stored file + - 1 = the first revision + - 2 = the second revision + - etc... + - -2 = the second most recent revision + - -1 = the most recent revision """ validate_string("filename", filename) @@ -764,12 +766,13 @@ class GridFSBucket(object): Defaults to -1 (the most recent revision). :Note: Revision numbers are defined as follows: - 0 = the original stored file - 1 = the first revision - 2 = the second revision - etc... - -2 = the second most recent revision - -1 = the most recent revision + + - 0 = the original stored file + - 1 = the first revision + - 2 = the second revision + - etc... + - -2 = the second most recent revision + - -1 = the most recent revision """ gout = self.open_download_stream_by_name(filename, revision) for chunk in gout: