diff --git a/lib/mongoid/grid_fs.rb b/lib/mongoid/grid_fs.rb index 289bffb..9acbe1f 100644 --- a/lib/mongoid/grid_fs.rb +++ b/lib/mongoid/grid_fs.rb @@ -186,6 +186,7 @@ def [](filename) file_model .where(filename: filename.to_s) .order_by(uploadDate: :desc) + .extras(hint: { filename: 1 }) .limit(1) .first end