@@ -122,7 +122,7 @@ class directly.
122122 def __erase (self ):
123123 """Erase all of the data stored in this GridFile.
124124 """
125- grid_file = self .__collection .files .find_one (self .__id )
125+ grid_file = self .__collection .files .find_one ({ "_id" : self .__id } )
126126 grid_file ["next" ] = None
127127 grid_file ["length" ] = 0
128128 self .__collection .files .save (grid_file )
@@ -139,9 +139,9 @@ def mode(self):
139139
140140 def __create_property (field_name , read_only = False ):
141141 def getter (self ):
142- return self .__collection .files .find_one (self .__id ).get (field_name , None )
142+ return self .__collection .files .find_one ({ "_id" : self .__id } ).get (field_name , None )
143143 def setter (self , value ):
144- grid_file = self .__collection .files .find_one (self .__id )
144+ grid_file = self .__collection .files .find_one ({ "_id" : self .__id } )
145145 grid_file [field_name ] = value
146146 self .__collection .files .save (grid_file )
147147 if not read_only :
@@ -166,7 +166,7 @@ def rename(self, filename):
166166 :Parameters:
167167 - `filename`: the new name for this GridFile
168168 """
169- grid_file = self .__collection .files .find_one (self .__id )
169+ grid_file = self .__collection .files .find_one ({ "_id" : self .__id } )
170170 grid_file ["filename" ] = filename
171171 self .__collection .files .save (grid_file )
172172
@@ -211,7 +211,7 @@ def flush(self):
211211 md5 = self .__collection .database ()._command (SON ([("filemd5" , self .__id ),
212212 ("root" , self .__collection .name ())]))["md5" ]
213213
214- grid_file = self .__collection .files .find_one (self .__id )
214+ grid_file = self .__collection .files .find_one ({ "_id" : self .__id } )
215215 grid_file ["md5" ] = md5
216216 grid_file ["length" ] = self .__position + len (self .__buffer )
217217 self .__collection .files .save (grid_file )
0 commit comments