ankusa
ankusa copied to clipboard
Ankusa appears to use older MongoDB connection driver
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?
Hey @ghostfreeman - sure, it would be pretty easy. There are really two options:
- Update https://github.com/bmuller/ankusa/blob/master/ankusa.gemspec#L17 to reference the specific version that works
- 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!
Best approach will be to require mongo 1.6.0. I will push a PR later today with the fix.