开发者

Problem with MongoDB Ruby Driver

I'm on Ubuntu, and I've done

install gem mongo

which reported

Successfully installed bson-1.0
Successfully installed mongo-1.0
2 gems installed

I've started mongod

Now I cd to the mongo gem directory and try

> ruby examples/simple.rb

and I get the error

./examples/../lib/mongo.rb:31:in `require': no such file to load -- bson (LoadError)
    from ./examples/../lib/mongo.rb:31
    from examples/simple.rb:3:in `require'
    from exampl开发者_如何学Goes/simple.rb:3

which I can't make sense of, since the bson gem is installed

> gem list
*** LOCAL GEMS ***

bson (1.0)
bson_ext (1.0)
mongo (1.0)
rack (1.1.0)
sinatra (1.0)

Any suggestions what's up here?


The example script doesn't require rubygems, which means that bson isn't going to be in your load path. If you add

require 'rubygems'

to the start of the script, I believe it will work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜