diff --git a/docs/guide/gridfs.rst b/docs/guide/gridfs.rst index d81bb922..596585de 100644 --- a/docs/guide/gridfs.rst +++ b/docs/guide/gridfs.rst @@ -20,7 +20,7 @@ a document is created to store details about animals, including a photo:: marmot = Animal(genus='Marmota', family='Sciuridae') - marmot_photo = open('marmot.jpg', 'r') + marmot_photo = open('marmot.jpg', 'rb') marmot.photo.put(marmot_photo, content_type = 'image/jpeg') marmot.save() @@ -70,5 +70,5 @@ Replacing files Files can be replaced with the :func:`replace` method. This works just like the :func:`put` method so even metadata can (and should) be replaced:: - another_marmot = open('another_marmot.png', 'r') + another_marmot = open('another_marmot.png', 'rb') marmot.photo.replace(another_marmot, content_type='image/png')