mongoidで遊んでみる

apt-get install mongodb
を一応しました。

Gemfileに
gem "mongoid"
gem "bson_ext"
を書いて、bundle install

あと、今回はMongoHQも使ってみようと思います。
http://mongohq.comから会員登録して無料のプランを使ってみます。
DBを作るとURIを発行してもらえるので、そいつをmongoid.ymlに書きます。
rails cで確認してみると・・・

1.9.2 :001 > Hoge.new
 => #<Hoge _id: 4e16f2cee22d5c1e45000001, _type: nil, title: nil>
1.9.2 :002 > hoge = _
 => #<Hoge _id: 4e16f2cee22d5c1e45000001, _type: nil, title: nil> 
1.9.2 :003 > hoge.title = "aaa"
 => "aaa" 
1.9.2 :004 > hoge.save
 => true 
1.9.2 :005 > hoge
 => #<Hoge _id: 4e16f2cee22d5c1e45000001, _type: nil, title: "aaa"> 

あら簡単。

ちなみに、MongoHQは無料で16M。
その他はhttps://mongohq.com/pricing参照