1

I am using mongoid_grid gem to store my files. It is working fine on development but while running cucumber test I am getting this error:

Database command 'filemd5' failed: {"errmsg"=>"exception: best guess plan requested, but scan and order required: query: { files_id: ObjectId('4d8728605835068603000024') } order: { files_id: 1, n: 1 } choices: { $natural: 1 } ", "code"=>13284, "ok"=>0.0} 

I also tried

db.fs.chunks.ensureIndex({files_id:1, n:1}, {unique: true});

but it does not seem to work. When I run one scenario at a time the tests pass but when I run all of them once they fail with above error. Am I missing something here?

Sadiksha Gautam
  • 5,032
  • 6
  • 40
  • 71
  • A bit late on this, but I'm having similar issues with MongoMapper. Is this a MongoDB core bug? – Ethan Turkeltaub Nov 05 '11 at 13:40
  • I think it has something to do with indexing. I am not very sure. There were some other pressing matters at hand, so I haven't found the solution yet! If you find it, please let me know as well. – Sadiksha Gautam Nov 05 '11 at 20:59
  • 1
    It seems like removing `:slave_ok => true` from my MM configuration did the trick. Weird bug, though. – Ethan Turkeltaub Nov 11 '11 at 00:33

0 Answers0