db.fs.files is supposed to have an index ensured on "filename". Instead, the index is created on db.fs.chunks, where it isn't useful.
The GridFS spec says:
For efficient execution of various GridFS operations the following indexes MUST exist:
- an index on { filename : 1, uploadDate : 1 } on the files collection
- a unique index on { files_id : 1, n : 1 } on the chunks collection