title: Two "id" fields in one MongoDB collection with Rails 3?
body: <p>I've got a Rails 3.0.9 project using the latest version of MongoDB and Mongoid 2.2.</p>
  
  <p>I imported a CSV with an "id" field into a MongoDB collection named College, resulting in a collection like so:</p>
  
  <pre><code>{ "_id" : ObjectID("abc123"), "id" : ######, ... }
  </code></pre>
  
  <p>Observations: </p>
  
  <ol>
  <li>The show action results in a URL utilizing the ObjectID </li>
  <li>Displaying 'college.id' in index.html.erb displays the ObjectID</li>
  </ol>
  
  <p>Questions:</p>
  
  <ol>
  <li>How do I use the original "id" field as the parameter  </li>
  <li>Is "id" reserved by MongoDB, meaning I need to rename the "id" field in the
  College collection (perhaps to "code") - if so, how?</li>
  </ol>
  
  <p>Thanks!</p>
  
  <p><strong>Update</strong></p>
  
  <p>Answer:</p>
  
  <pre><code>db.colleges.update( { "name" : { $exists : true } } , { $rename : { "id" : "code" } }, false, true )
  </code></pre>
  
  <p>I used "name" since that was a field I could check for the existence.</p>