我使用的是Ruby 2.2。我已经安装了mongo
gem,但仍然收到错误:
MY-MAC:ruby-2.2.0 me$ gem list
*** LOCAL GEMS ***
bigdecimal (1.2.6)
bson (4.0.3)
bundler (1.10.6)
bundler-unload (1.0.2)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
io-console (0.4.3)
json (1.8.1)
log4r (1.1.10)
mini_portile2 (2.0.0)
minitest (5.4.3)
mongo (2.2.3)
nokogiri (1.6.7.2)
power_assert (0.2.2)
psych (2.0.8)
rake (10.4.2)
rdoc (4.2.0)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
test-unit (3.0.8)
MY-MAC:ruby-2.2.0 me$ irb
2.2.0 :001 > require 'mongo'
=> true
2.2.0 :002 > include Mongo
=> Object
2.2.0 :003 > Mongo::VERSION
=> "2.2.3"
2.2.0 :004 > c = MongoClient.new
NameError: uninitialized constant MongoClient
from (irb):4
from /Users/me/.rvm/rubies/ruby-2.2.0/bin/irb:11:in `<main>'
2.2.0 :005 >
问题是什么?