ankusa icon indicating copy to clipboard operation
ankusa copied to clipboard

Ankusa appears to use older MongoDB connection driver

Open kingthrillgore opened this issue 9 years ago • 2 comments

I'm not entirely sure what the cause could be here, but when running Ankusa from rubygems, any attempt to connect to Mongo returns this error

/Library/Ruby/Gems/2.0.0/gems/ankusa-0.1.0/lib/ankusa/mongo_db_storage.rb:12:in initialize': uninitialized constant Mongo::Connection (NameError) from app.rb:11:in new' from app.rb:11:in

`

The actual code refers to a method that is not used in the current Mongo gem. @db = Mongo::Connection.new(options[:host], options[:port]).db(options[:db]) It should be: @db = Mongo::Client.new([:host+":"+:port], :database => :db) or similar.

Is there a way to force Ankusa to use an older Mongo gem?

kingthrillgore avatar Nov 13 '15 14:11 kingthrillgore

Hey @ghostfreeman - sure, it would be pretty easy. There are really two options:

  1. Update https://github.com/bmuller/ankusa/blob/master/ankusa.gemspec#L17 to reference the specific version that works
  2. Update that line you referenced (and any others needed) to get it working with the new gem.

If you submit a PR for either, I'd happily merge and release a new version of the gem. Thanks!

bmuller avatar Nov 13 '15 14:11 bmuller

Best approach will be to require mongo 1.6.0. I will push a PR later today with the fix.

kingthrillgore avatar Nov 13 '15 16:11 kingthrillgore