mongodb/mongo-ruby-driver — pull request #254 by aleksclark (2013-08-26 20:53:45+00:00)
Title: 1.x stable

add an option no_grid_ensure_index.

without this option, gridfs recreates indexes on every file read, and twice on puts

this is due to the fact that the [] method on Mongo::DB instantiates a new collection every time a new
Mongo::Grid is created. This causes the cache used by ensure_index to be empty every time, in turn
causing indexes to be rewritten

This patch is only really useful if for some (likely unjustifiable) reason you're creating Mongo::Grid lots of times, but if you are, it's nice to have the option not to spend time ensuring index.