mongoid/mongoid — Issue #1555: #find throwing BSON::InvalidObjectId instead of DocumentNotFound
Author: tanob
Created: 2012-01-05 22:17:40+00:00
State: open

Today after upgrading to mongoid 2.4.0 one spec started to fail, now #find throws BSON::InvalidObjectId instead of DocumentNotFound:

```ruby
require 'bundler'
Bundler.require

Mongoid.configure do |config|
config.master = Mongo::Connection.new.db("godfather")
end

class Foo
include Mongoid::Document
end

begin
Foo.find('1234')
rescue Mongoid::Errors::DocumentNotFound
puts "Document not found."
exit 0
end

exit -1
```

Running `git bisect` I've found that the following checkin introduced this problem:

1011f8d937ec8b0799564bec7c2c0fb8e42eca2b is the first bad commit
commit 1011f8d937ec8b0799564bec7c2c0fb8e42eca2b
Author: Durran Jordan
Date: Sat Dec 3 11:38:10 2011 +0100

Convert params to Model.find(id) to whatever the _id field type is defined as, no matter what the type. Closes #1380.

Can you confirm this is a bug?

Thanks!