Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't create MongoClient.new

Tags:

ruby

mongodb

gem

I don't know what the deal is with this. Everything works fine until i try to create a new MongoClient

irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'mongo'
=> true
irb(main):003:0> include Mongo
=> Object
irb(main):004:0> client = MongoClient.new('127.0.0.1', 27017)
NameError: uninitialized constant MongoClient
        from (irb):4
        from :0
irb(main):005:0>
like image 328
Jaron Bradley Avatar asked Dec 21 '12 16:12

Jaron Bradley


1 Answers

You are using an older version (1.5.2) of the mongo gem instead of the most current one (1.8.0). That days the connection has been made by

conn = Mongo::Connection.new

Find out more in the documentation of version 1.5.2

like image 96
iltempo Avatar answered Sep 30 '22 05:09

iltempo