title: Date in Mongoid queries
body: <p>I have a model:</p>
  
  <pre><code>class SimpleAction
    include Mongoid::Document
    field :set_date, :type =&gt; Date
  </code></pre>
  
  <p>and I have some data in collection:</p>
  
  <blockquote>
    <p>{ "_id" : ObjectId("4f6dd2e83a698b2518000006"), "name" : "lost",
    "notes" : "", "set_date(1i)" : "2012", "set_date(2i)" : "3",
    "set_date(3i)" : "25", "set_date(4i)" : "13", "set_date(5i)" : "57",
    "duration" : 15, "todo" : "4" }</p>
  </blockquote>
  
  <p>You can see that mongoid store date in the five fields - set_date(ni).</p>
  
  <p>I have two question:</p>
  
  <ul>
  <li><p>How can I filter data by set_date field in the mongo console client?  Something like this:</p>
  
  <pre><code>db.simple_actions.find({ set_date : { "$lte" : new Date() } })
  </code></pre>
  
  <p>My query didn't return any data.</p></li>
  <li><p>How can I filter data by set_date field in my Rails controller? Something like this:</p>
  
  <pre><code>@simple_actions = SimpleAction.where(:set_date =&gt; { '$lte' =&gt; Date.today })
  </code></pre></li>
  </ul>