title: How to get new mongoid indexes for a model
body: <p>Let's say I have defined my model Person with a couple of indexes:</p>
  
  <pre><code>class Person
    include Mongoid::Document
    field :email
    field :ssn
  
    index({ email: 1 }, { unique: true })
    index({ ssn: 1 }, { unique: true })
  end
  </code></pre>
  
  <p>However, only the email index already exists in the database, so when I call</p>
  
  <pre><code>Person.collection.indexes.each {|i| puts i.inspect}
  </code></pre>
  
  <p>I get the following response:</p>
  
  <pre><code>{"v"=&gt;1, "key"=&gt;{"_id"=&gt;1}, "name"=&gt;"_id_", "ns"=&gt;"x.person"}
  {"v"=&gt;1, "unique"=&gt;true, "key"=&gt;{"email"=&gt;1}, "name"=&gt;"email_1", "ns"=&gt;"x.person"}
  </code></pre>
  
  <p>The question is, how can I get the list of defined indexes in the model, even if they are not already created in mongo ?</p>
  
  <p>In my case, such list should include the definition for the field "ssn"</p>
  
  <p>In other words...How to get those indexes that haven't been created yet ?</p>