title: Mongoid update attributes : how not to insert when field names don't already exist in the collection
body: <p>I'm trying to do update_attributes with Mongoid in a Rails 3 application</p>
  
  <p>The problem I'm running into is this:</p>
  
  <p>Let's say my collection has the following fields:</p>
  
  <p>{"Name" : "foo", "email" : "bar" }</p>
  
  <p><strong>Here's the scenario</strong></p>
  
  <p>if I do this:</p>
  
  <pre><code>@person = Person.where(:Name =&gt; "foo", :_id = "some_id")
  </code></pre>
  
  <p>and then I do this:</p>
  
  <pre><code>@person.update_attributes(:Name =&gt; "baba-fooka", :Last_Name =&gt; "baba-bara")
  </code></pre>
  
  <p>The line of code above updates the record in mongodb, but also <strong>adds a new field</strong> to the document.</p>
  
  <p>How can I use the update_attributes method with a validation which doesn't allow inserting fields which don't already exist </p>