tags:

views:

115

answers:

1

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 examples/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?

+1  A: 

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.

Kyle Banker