title: Store functions in mongodb using Mongoid 3
body: <p>Just as the title suggests. I am not able to find anything related to Mongoid 3. The things I found only apply to old versions of <code>mongoid</code> that didn't use <code>Moped</code>.</p>
  
  <p>I found this and it doesn't work:</p>
  
  <pre><code>def self.install_javascript
    getWeekJs = Rails.root.join("lib/javascript/getWeek.js")
    if collection.master['system.js'].find_one({'_id' =&gt; "getWeek"}).nil?
      collection.master.db.add_stored_function("getWeek", File.new(getWeekJs).read)
    end
  end
  </code></pre>
  
  <p>This method would add a getWeek function to the system.js collection.</p>
  
  <p>How can this be done in mongoid 3?</p>