anlek/mongify

error when trying to connect to mongodb

Closed this issue · 12 comments

Hi there.. i was wondering if you could help me..
When running : mongify check database.config I'm getting the following error for the nosql connetion -same error applies when running the translation ..
SQL connection works
/usr/local/lib/ruby/gems/2.3.0/gems/mongify-1.2.4/lib/mongify/database/no_sql_connection.rb:66:in setup_connection_adapter': uninitialized constant Mongify::Database::NoSqlConnection::Connection (NameError) from /usr/local/lib/ruby/gems/2.3.0/gems/mongify-1.2.4/lib/mongify/database/no_sql_connection.rb:76:inconnection'
from /usr/local/lib/ruby/gems/2.3.0/gems/mongify-1.2.4/lib/mongify/database/no_sql_connection.rb:82:in has_connection?' from /usr/local/lib/ruby/gems/2.3.0/gems/mongify-1.2.4/lib/mongify/cli/command/worker.rb:100:incheck_nosql_connection'
from /usr/local/lib/ruby/gems/2.3.0/gems/mongify-1.2.4/lib/mongify/cli/command/worker.rb:65:in execute' from /usr/local/lib/ruby/gems/2.3.0/gems/mongify-1.2.4/lib/mongify/cli/application.rb:28:inexecute!'
from /usr/local/lib/ruby/gems/2.3.0/gems/mongify-1.2.4/bin/mongify:15:in <top (required)>' from /usr/local/bin/mongify:22:inload'
from /usr/local/bin/mongify:22:in `

'

Let me know if you need more info from me .. the mongo db is hosted on mlab and I can access it online
Has anyone else come across to this before?

anlek commented

It's hard to figure out without seeing your database.config file.
Can you please share it (Just remove any passwords and IP addresses).

sql_connection do
adapter "mysql"
host ""
username ""
password ""
database ""
batch_size 10000
end

mongodb_connection do
host ""
database ""
end

I have tried different options for mongo but nosql connection still errors

anlek commented

Can you give me the list of gems installed on your system? I think you might have a newer version of mongo gem.

yes of course .. please see below:
*** LOCAL GEMS ***

activemodel (3.2.22.2)
activerecord (3.2.22.2)
activerecord-mysql-adapter (0.0.1)
activesupport (3.2.22.2)
arel (3.0.3)
bigdecimal (1.2.8)
bson (4.0.4, 1.12.5, 1.10.2)
bson_ext (1.12.5, 1.10.2)
builder (3.0.4)
bundler (1.11.2)
chunky_png (1.3.5)
compass (1.0.3)
compass-core (1.0.3)
compass-import-once (1.0.5)
did_you_mean (1.0.0)
ffi (1.9.10)
highline (1.7.8)
i18n (0.7.0)
io-console (0.4.5)
json (1.8.3)
minitest (5.8.3)
mongify (1.2.4)
mongify-mongoid (1.0.4)
mongo (2.2.4, 1.10.2)
multi_json (1.11.2)
mysql (2.9.1)
net-telnet (0.1.1)
power_assert (0.2.6)
psych (2.0.17)
rake (10.5.0, 10.4.2)
rb-fsevent (0.9.7)
rb-inotify (0.9.7)
rdoc (4.2.1)
rubygems-update (2.5.2)
sass (3.4.21)
test-unit (3.1.5)
tzinfo (0.3.47)

I have two versions of mongo gem: 2.2.4, 1.10.2
Do you think I should downgrade?

Hi there! Do you have an update please ? I got stuck with this so I was wondering if you have any ideas. Let me know if you need anything else ..

anlek commented

Try removing the 2.2.4 mongo gem and see if it works.

Success - Tyvm .. had to edit my database.config and now both SQL and NoSQL connections are working !
I am getting this also but I will investigate later:
** Notice: The native BSON extension was not loaded. **

  For optimal performance, use of the BSON extension is recommended.

  To enable the extension make sure ENV['BSON_EXT_DISABLED'] is not set
  and run the following command:

    gem install bson_ext

  If you continue to receive this message after installing, make sure that
  the bson_ext gem is in your load path.
anlek commented

So did it work once you downgraded the drivers?

As for the BSON extension issue. You can just do gem install bson_ext to make it go away. (And improve your mongo queries/inserts).

sorry for the delay
yes, I have downgraded mongo gem and had to update also the config file as it wouldn't like the one I was using earlier.

sorry for the delay
yes, I have downgraded mongo gem and had to update also the config file as it wouldn't like the one I was using earlier.

Why wouldn't you include fixed config file? I hate ppl like this, solved the problem and didn't include the solution. Extremely selfish.