mongoid/mongoid — Issue #1796: Documentation Suggestion
Author: BBonifield
Created: 2012-03-07 17:22:35+00:00
State: open

Make note that Mongoid allows you to specify a custom name for an index -- http://mongoid.org/docs/indexing.html

I ran into an error where the auto-generated index name on my compound index was too long. I couldn't find any reference to how you would override that name using Mongoid, but I knew it was possible with Mongo directly. I took a guess and appended ```:name => 'my name'```, and it worked. I just think it might be helpful to have this noted in the docs.

```
b rake db:mongoid:create_indexes
Failed to create indexes for Consumer:
Mongo::OperationFailure:Failed to create index {:name=>"something_very_long", :ns=>"project_development.consumers", :key=>{"all" => 1, "my" => 1, "keys" => 1}, :unique=>false}
with the following error: 10080: ns name too long, max size is 128
```