How to make it work with Mongoid? #7

Closed
millisami opened this Issue Mar 22, 2012 · 0 comments

Comments

Projects
None yet
2 participants

I gave it a try like the Readme says and it just works.

Then I wanted to use it with the Mongoid gem, however it complains that it needs the MongoDB version 2.0.0

require 'bundler/setup'
require 'embedded-mongo'
require 'mongoid'

Mongoid.configure do |config|
  config.master = EmbeddedMongo::Connection.new.db("godfather")
end

class Account
  include Mongoid::Document

  field :name

end

ac = Account.new
ac.name = "Sachin"
ac.save!

puts ac.inspect

Following is the backtrace:

be ruby app.rb                                                                                                                                                                                      

**Notice: C extension not loaded. This is required for optimum MongoDB Ruby driver performance.
  You can install the extension as follows:
  gem install bson_ext

  If you continue to receive this message after installing, make sure that the
  bson_ext gem is in your load path and that the bson_ext and mongo gems are of the same version.

/Users/millisami/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.3.4/lib/mongoid/config.rb:294:in `check_database!': MongoDB 1.8.0 not supported, please upgrade to 2.0.0. (Mongoid::Errors::UnsupportedVersion)
    from /Users/millisami/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.3.4/lib/mongoid/config.rb:217:in `master='
    from app.rb:15:in `block in <main>'
    from /Users/millisami/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.3.4/lib/mongoid.rb:115:in `configure'
    from app.rb:14:in `<main>'

How it can be fixed?

gdb closed this in f727ed6 Oct 31, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment