ahoward/mongoid-grid_fs — pull request #16 by ngty (2013-04-07 14:57:12+00:00)
Title: Fix accessing file more than 42mb

Sorry, this is a retry of the original pull#15. I'm doing it proper now with test case in place, as well as doing it on a separate branch.

When doing `File#each` for total chunk size more than 42mb, the following error is observed:

[2013-04-05 15:29:36] ERROR Moped::Errors::QueryFailure: The operation: #{"files_id"=>"515e7d5fc5fe824fdb000001", "n"=>{"$lt"=>9, "$gte"=>0}}, "$orderby"=>{"n"=>1}}
@fields=nil>
failed with error 10128: "too much data for sort() with no index. add an index or specify a smaller limit"
See https://github.com/mongodb/mongo/blob/master/docs/errors.md

I'm thinking if there is a way to specify query projection for the `has_many :chunks`, this can hack can probably be avoided, but alas, i can't figure out a way to do it.