У меня есть приложение, которое загружает файлы в GridFS через MongoMapper / Joint в Падрино.Все работало нормально, и вдруг я получаю сообщение об ошибке:
Mongo::OperationFailure at /admin/wallpapers/create
Database command 'filemd5' failed: (errmsg: 'exception: best guess plan requested, but scan and order required: query: { files_id: ObjectId('4eaf4abf9972772c94000003') } order: { files_id: 1, n: 1 } choices: { $natural: 1 } '; code: '13284'; ok: '0.0').
Трассировка стека:
Mongo::OperationFailure - Database command 'filemd5' failed: (errmsg: 'exception: best guess plan requested, but scan and order required: query: { files_id: ObjectId('4eaf4c719972772c9400000b') } order: { files_id: 1, n: 1 } choices: { $natural: 1 } '; code: '13284'; ok: '0.0').:
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/mongo-1.4.1/lib/mongo/db.rb:520:in `command'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/mongo-1.4.1/lib/mongo/gridfs/grid_io.rb:463:in `get_md5'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/mongo-1.4.1/lib/mongo/gridfs/grid_io.rb:453:in `to_mongo_object'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/mongo-1.4.1/lib/mongo/gridfs/grid_io.rb:238:in `close'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/mongo-1.4.1/lib/mongo/gridfs/grid.rb:73:in `put'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/joint-0.6.0/lib/joint/instance_methods.rb:22:in `block in save_attachments'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/joint-0.6.0/lib/joint/instance_methods.rb:18:in `each_pair'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/joint-0.6.0/lib/joint/instance_methods.rb:18:in `save_attachments'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:416:in `_run_save_callbacks'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:94:in `run_callbacks'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/mongo_mapper-0.9.2/lib/mongo_mapper/plugins/embedded_callbacks.rb:28:in `run_callbacks'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/mongo_mapper-0.9.2/lib/mongo_mapper/plugins/callbacks.rb:14:in `create_or_update'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/mongo_mapper-0.9.2/lib/mongo_mapper/plugins/querying.rb:143:in `save'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/mongo_mapper-0.9.2/lib/mongo_mapper/plugins/dirty.rb:20:in `block in save'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/mongo_mapper-0.9.2/lib/mongo_mapper/plugins/dirty.rb:42:in `clear_changes'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/mongo_mapper-0.9.2/lib/mongo_mapper/plugins/dirty.rb:20:in `save'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/mongo_mapper-0.9.2/lib/mongo_mapper/plugins/validations.rb:23:in `save'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/mongo_mapper-0.9.2/lib/mongo_mapper/plugins/querying.rb:30:in `block in create'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/mongo_mapper-0.9.2/lib/mongo_mapper/plugins/querying.rb:113:in `block in initialize_each'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/mongo_mapper-0.9.2/lib/mongo_mapper/plugins/querying.rb:111:in `each'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/mongo_mapper-0.9.2/lib/mongo_mapper/plugins/querying.rb:111:in `initialize_each'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/mongo_mapper-0.9.2/lib/mongo_mapper/plugins/querying.rb:30:in `create'
/var/www/fhsclock/admin/controllers/wallpapers.rb:13:in `block (2 levels) in <top (required)>'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/padrino-core-0.10.0/lib/padrino-core/application/routing.rb:486:in `call'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/padrino-core-0.10.0/lib/padrino-core/application/routing.rb:486:in `block in route'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/sinatra-1.2.7/lib/sinatra/base.rb:736:in `instance_eval'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/sinatra-1.2.7/lib/sinatra/base.rb:736:in `route_eval'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/padrino-core-0.10.0/lib/padrino-core/application/routing.rb:49:in `block (2 levels) in process_destination_path'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/padrino-core-0.10.0/lib/padrino-core/application/routing.rb:49:in `catch'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/padrino-core-0.10.0/lib/padrino-core/application/routing.rb:49:in `block in process_destination_path'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/padrino-core-0.10.0/lib/padrino-core/application/routing.rb:22:in `instance_eval'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/padrino-core-0.10.0/lib/padrino-core/application/routing.rb:22:in `process_destination_path'
(eval):16:in `block (2 levels) in inject_root_methods'
(eval):6:in `catch'
(eval):6:in `block in inject_root_methods'
(eval):313:in `block in inject_root_methods'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/http_router-0.8.11/lib/http_router/node/root.rb:68:in `[]'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/http_router-0.8.11/lib/http_router.rb:110:in `block in call'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/http_router-0.8.11/lib/http_router.rb:110:in `catch'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/http_router-0.8.11/lib/http_router.rb:110:in `call'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/padrino-core-0.10.0/lib/padrino-core/application/routing.rb:796:in `route!'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/padrino-core-0.10.0/lib/padrino-core/application/routing.rb:785:in `dispatch!'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/sinatra-1.2.7/lib/sinatra/base.rb:656:in `block in call!'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/sinatra-1.2.7/lib/sinatra/base.rb:820:in `block in invoke'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/sinatra-1.2.7/lib/sinatra/base.rb:820:in `catch'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/sinatra-1.2.7/lib/sinatra/base.rb:820:in `invoke'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/sinatra-1.2.7/lib/sinatra/base.rb:656:in `call!'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/sinatra-1.2.7/lib/sinatra/base.rb:641:in `call'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/rack-flash-0.1.2/lib/rack/flash.rb:147:in `call'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/padrino-core-0.10.0/lib/padrino-core/reloader.rb:243:in `call'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/padrino-core-0.10.0/lib/padrino-core/logger.rb:300:in `call'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/sinatra-1.2.7/lib/sinatra/showexceptions.rb:21:in `call'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/rack-1.3.5/lib/rack/session/abstract/id.rb:195:in `context'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/rack-1.3.5/lib/rack/session/abstract/id.rb:190:in `call'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/rack-1.3.5/lib/rack/head.rb:9:in `call'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/sinatra-1.2.7/lib/sinatra/showexceptions.rb:21:in `call'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/rack-1.3.5/lib/rack/methodoverride.rb:24:in `call'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/sinatra-1.2.7/lib/sinatra/base.rb:1292:in `block in call'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/sinatra-1.2.7/lib/sinatra/base.rb:1323:in `synchronize'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/sinatra-1.2.7/lib/sinatra/base.rb:1292:in `call'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/padrino-core-0.10.0/lib/padrino-core/router.rb:71:in `block in call'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/padrino-core-0.10.0/lib/padrino-core/router.rb:64:in `each'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/padrino-core-0.10.0/lib/padrino-core/router.rb:64:in `call'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/thin-1.2.11/lib/thin/connection.rb:84:in `block in pre_process'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/thin-1.2.11/lib/thin/connection.rb:82:in `catch'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/thin-1.2.11/lib/thin/connection.rb:82:in `pre_process'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/thin-1.2.11/lib/thin/connection.rb:57:in `process'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/thin-1.2.11/lib/thin/connection.rb:42:in `receive_data'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/thin-1.2.11/lib/thin/backends/base.rb:61:in `start'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/thin-1.2.11/lib/thin/server.rb:159:in `start'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/rack-1.3.5/lib/rack/handler/thin.rb:13:in `run'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/rack-1.3.5/lib/rack/server.rb:265:in `start'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/padrino-core-0.10.0/lib/padrino-core/server.rb:44:in `start'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/padrino-core-0.10.0/lib/padrino-core/server.rb:34:in `start'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/padrino-core-0.10.0/lib/padrino-core/server.rb:13:in `run!'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/padrino-core-0.10.0/lib/padrino-core/cli/adapter.rb:7:in `start'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/padrino-core-0.10.0/lib/padrino-core/cli/base.rb:24:in `start'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/gems/padrino-core-0.10.0/bin/padrino:9:in `<top (required)>'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/bin/padrino:19:in `load'
/home/ethan/.rvm/gems/ruby-1.9.2-p290@fhsclock/bin/padrino:19:in `<main>'
Этот поток включенгруппа MongoMapper предлагает мне запустить ensure_index
(или create_index
) для коллекции files.chunk
.Однако я не знаю, как это сделать с MongoMapper.
Есть ли способ предотвратить это?