title: Ruby on Rails and NoSQL, adding fields
body: <p>I'm just diving into Mongodb and MongoID with Rails and I find it awesome. One thing the NoSQL helps is when I can add extra fields to my model without any extra effort whenever I want:</p>
  
  <pre><code>class Page
    include Mongoid::Document
    include Mongoid::MultiParameterAttributes
    field :title, :type =&gt; String
    field :body, :type =&gt; String
    field :excerpt, :type =&gt; String #Added later
    field :location, :type =&gt; String #Added later
    field :published_at, :type =&gt; Time
  
    validates :title, :presence =&gt; true
    validates :body, :presence =&gt; true
    validates :excerpt, :presence =&gt; true
  end
  </code></pre>
  
  <p>And this works perfectly as it should. But my question is, (sorry if this is trivial) the existing entries are blank and have no defined value for the newly added field. For example, in a sample blog application, after I've published two posts, I decide to add an excerpt and a location field to my database (refer code above). Any blog post that is published after the addition of these new fields can be made sure to have a value filled in for the excerpt field. But the posts published prior to the addition of these two new fields have null values (which is understandable why) which I cannot validate. Is there an elegant solution for this? </p>
  
  <p>Thank you.</p>