2012年1月18日水曜日

MongoDBのRubyドライバー

MongoDBのRubyドライバーのgemのインストールについてのメモです。
下記ではrvmを用いてます。
$ rvm gem use 1.9.2
$ rvm gemset use rails3
$ gem install mongo
Fetching: bson-1.5.2.gem (100%)
Fetching: mongo-1.5.2.gem (100%)
Successfully installed bson-1.5.2
Successfully installed mongo-1.5.2
2 gems installed

Installing ri documentation for bson-1.5.2...
Installing ri documentation for mongo-1.5.2...
Installing RDoc documentation for bson-1.5.2...
Installing RDoc documentation for mongo-1.5.2...

$ gem list --local

bson (1.5.2)
mongo (1.5.2)
 いざ、実行してみると
require 'mongo'
db = Mongo::Connection.new.db("test")
こんなエラー…。 gemが足りないようです。

$ ruby mongo_test.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.

下記を入れたら、無事実行できました!
$ gem install bson_ext
Fetching: bson_ext-1.5.2.gem (100%)
Building native extensions.  This could take a while...
Successfully installed bson_ext-1.5.2
1 gem installed

Installing ri documentation for bson_ext-1.5.2...
Installing RDoc documentation for bson_ext-1.5.2...
$ gem list --local
bson (1.5.2)
bson_ext (1.5.2)
mongo (1.5.2)

下記を見たら、もしかしたらbson_extだけで良かったのかも
http://api.mongodb.org/ruby/current/file.TUTORIAL.html

0 件のコメント:

コメントを投稿

注: コメントを投稿できるのは、このブログのメンバーだけです。