anlek / mongify

Mongify allows you to map your data from a sql database and into a mongodb document database.
http://github.com/anlek/mongify
MIT License
317 stars 82 forks source link

Gem :: Load error while using Mongify #172

Closed irfanjs closed 6 years ago

irfanjs commented 6 years ago

Hello, i am using Mongify to migrate from mYsql to MongoDB . however facing issues while resolving that. tried all the possible options but still facing issues. can you please have a look on following URL and see if you can help https://stackoverflow.com/questions/51747980/gem-load-error-while-migrating-from-mysql-to-mongodb

Regards,

anlek commented 6 years ago

There is a possibility that Mongify doesn't work well in ruby 2.5. I'd recommend using Ruby 2.3 as it's been tested in very well. Let me know if that works for you.

irfanjs commented 6 years ago

Thanks. I rammed down the ruby version to 2.3 and it was successful. however, processcommand failed with following error:

C:\Users\if\Downloads>mongify process database.config translation.rb Copying appliance (1/1): (1/1) 100% |ooooo| Time: 00:00:00 Copying bat (1/1): (544/544) 100% |ooooo| Time: 00:00:00 Copying buildinfo (1/2): (10000/10000) 100% |ooooo| Time: 00:00:01 Copying buildinfo (2/2): (1358/1358) 100% |ooooo| Time: 00:00:00 Copying codecollaborator (1/2): (10000/10000) 100% |ooooo| Time: 00:00:01 Copying codecollaborator (2/2): (6617/6617) 100% |ooooo| Time: 00:00:01 Copying codecomplexity (1/1): (5593/5593) 100% |ooooo| Time: 00:00:00 Copying codecoverage (1/1): (7175/7175) 100% |ooooo| Time: 00:00:01 Copying findbug (1/1): (8566/8566) 100% |ooooo| Time: 00:00:01 Copying nightlybuild (1/1): (1574/1574) 100% |ooooo| Time: 00:00:00 Copying pmd (1/1): (8566/8566) 100% |ooooo| Time: 00:00:01 Copying projects (1/1): (3/3) 100% |ooooo| Time: 00:00:00 Copying regression (1/1): (98/98) 100% |ooooo| Time: 00:00:00 Copying unittest (1/1): (8105/8105) 100% |ooooo| Time: 00:00:00 Copying user_details (1/1): (5/5) 100% |ooooo| Time: 00:00:00 Updating References appliance: (1/1) 100% |ooooo| Time: 00:00:00 Updating References bat: (544/544) 100% |ooooo| Time: 00:00:12 Updating References buildinfo: (11358/11358) 100% |ooooo| Time: 00:06:44 Updating References codecollaborator: (16617/16617) 100% |ooooo| Time: 00:03:14 Updating References codecomplexity: (5593/5593) 100% |ooooo| Time: 00:01:05 Updating References codecoverage: (7175/7175) 100% |ooooo| Time: 00:01:23 Updating References findbug: (8566/8566) 100% |ooooo| Time: 00:01:40 Updating References nightlybuild: (1574/1574) 100% |ooooo| Time: 00:00:00 Updating References pmd: (8566/8566) 100% |ooooo| Time: 00:01:40 Updating References projects: (3/3) 100% |ooooo| Time: 00:00:00 Updating References regression: (98/98) 100% |ooooo| Time: 00:00:02 Updating References unittest: (8105/8105) 100% |ooooo| Time: 00:01:33 Updating References user_details: (5/5) 100% |ooooo| Time: 00:00:00 C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongo-1.12.5/lib/mongo/db.rb:610:in rescue i n command': Database command 'update' failed: BSON field 'update.multi' is an un known field. (Mongo::OperationFailure) from C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongo-1.12.5/lib/mongo/db.rb:606 :incommand' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongo-1.12.5/lib/mongo/collectio n_writer.rb:314:in block in send_write_command' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongo-1.12.5/lib/mongo/functiona l/logging.rb:55:inblock in instrument' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongo-1.12.5/lib/mongo/functiona l/logging.rb:20:in instrument' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongo-1.12.5/lib/mongo/functiona l/logging.rb:54:ininstrument' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongo-1.12.5/lib/mongo/collectio n_writer.rb:313:in send_write_command' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongo-1.12.5/lib/mongo/collectio n.rb:1104:insend_write' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongo-1.12.5/lib/mongo/collectio n.rb:497:in update' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongify-1.3.2/lib/mongify/databa se/no_sql_connection.rb:145:inremove_pre_mongified_ids' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongify-1.3.2/lib/mongify/transl ation/processor_common.rb:116:in block in remove_pre_mongified_ids' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongify-1.3.2/lib/mongify/transl ation/processor_common.rb:114:ineach' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongify-1.3.2/lib/mongify/transl ation/processor_common.rb:114:in remove_pre_mongified_ids' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongify-1.3.2/lib/mongify/transl ation/process.rb:18:inprocess' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongify-1.3.2/lib/mongify/cli/co mmand/worker.rb:72:in execute' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongify-1.3.2/lib/mongify/cli/ap plication.rb:28:inexecute!' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongify-1.3.2/bin/mongify:17:in <top (required)>' from C:/Ruby23/bin/mongify:22:inload' from C:/Ruby23/bin/mongify:22:in `

'

here is the Ruby env for your reference now ...

RubyGems Environment:
  - RUBYGEMS VERSION: 2.5.2
  - RUBY VERSION: 2.3.3 (2016-11-21 patchlevel 222) [i386-mingw32]
  - INSTALLATION DIRECTORY: C:/Ruby23/lib/ruby/gems/2.3.0
  - USER INSTALLATION DIRECTORY: C:/Users/irfan.sayed/.gem/ruby/2.3.0
  - RUBY EXECUTABLE: C:/Ruby23/bin/ruby.exe
  - EXECUTABLE DIRECTORY: C:/Ruby23/bin
  - SPEC CACHE DIRECTORY: C:/Users/irfan.sayed/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: C:/ProgramData
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-mingw32
  - GEM PATHS:
     - C:/Ruby23/lib/ruby/gems/2.3.0
     - C:/Users/irfan.sayed/.gem/ruby/2.3.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - C:\windows\system32
     - C:\windows
     - C:\windows\System32\Wbem
     - C:\Program Files (x86)\Microsoft Application Virtualization Client
     - C:\Program Files\PuTTY\
     - C:\apache-maven-3.5.2-bin\apache-maven-3.5.2\bin
     - "C:\Program Files\Java\jdk1.8.0_151\bin"
     - C:\Program Files\Git\cmd
     - C:\HashiCorp\Vagrant\bin
     - C:\windows\System32\WindowsPowerShell\v1.0\
     - C:\windows\System32\WindowsPowerShell\v1.0\
     - C:\Program Files\MySQL\MySQL Server 8.0\bin
     - C:\Program Files\MongoDB\Server\4.0\bin
     - C:\Ruby23\bin

please suggest ... regards,

anlek commented 6 years ago

What version of MongoDB are you running? Currently, only 3.2 or lower is supported.

irfanjs commented 6 years ago

ok. i downgraded mongodb version to 3.2.20. getting following error now ... BTW, i have created translation.rb file again using translation command

C:\Users\ir\Downloads>mongify database.config translation.rb
C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongify-1.3.2/lib/mongify/configuration.rb:14
:in `instance_eval': undefined method `table' for #<Mongify::Configuration:0x3bd
0990> (NoMethodError)
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongify-1.3.2/lib/mongify/config
uration.rb:14:in `instance_eval'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongify-1.3.2/lib/mongify/config
uration.rb:14:in `parse'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongify-1.3.2/lib/mongify/cli/op
tions.rb:78:in `config_file'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongify-1.3.2/lib/mongify/cli/op
tions.rb:58:in `parse'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongify-1.3.2/lib/mongify/cli/ap
plication.rb:27:in `execute!'
        from C:/Ruby23/lib/ruby/gems/2.3.0/gems/mongify-1.3.2/bin/mongify:17:in
`<top (required)>'
        from C:/Ruby23/bin/mongify:22:in `load'
        from C:/Ruby23/bin/mongify:22:in `<main>'

is the mongify gem is at correct version ? i am using mongify 1.3.2 please suggest Regards,

irfanjs commented 6 years ago

ohh i forgot to pass process option in mongify command. here is the latest output now ....

C:\Users\irfan.sayed\Downloads>mongify process database.config translation.rb Copying appliance (1/1): (1/1) 100% |ooooo| Time: 00:00:00 Copying bat (1/1): (544/544) 100% |ooooo| Time: 00:00:00 Copying buildinfo (1/2): (10000/10000) 100% |ooooo| Time: 00:00:02 Copying buildinfo (2/2): (1358/1358) 100% |ooooo| Time: 00:00:00 Copying codecollaborator (1/2): (10000/10000) 100% |ooooo| Time: 00:00:01 Copying codecollaborator (2/2): (6617/6617) 100% |ooooo| Time: 00:00:01 Copying codecomplexity (1/1): (5593/5593) 100% |ooooo| Time: 00:00:00 Copying codecoverage (1/1): (7175/7175) 100% |ooooo| Time: 00:00:01 Copying findbug (1/1): (8566/8566) 100% |ooooo| Time: 00:00:01 Copying nightlybuild (1/1): (1574/1574) 100% |ooooo| Time: 00:00:00 Copying pmd (1/1): (8566/8566) 100% |ooooo| Time: 00:00:01 Copying projects (1/1): (3/3) 100% |ooooo| Time: 00:00:00 Copying regression (1/1): (98/98) 100% |ooooo| Time: 00:00:00 Copying unittest (1/1): (8105/8105) 100% |ooooo| Time: 00:00:01 Copying user_details (1/1): (5/5) 100% |ooooo| Time: 00:00:00 Updating References appliance: (1/1) 100% |ooooo| Time: 00:00:00 Updating References bat: (544/544) 100% |ooooo| Time: 00:00:16 Updating References buildinfo: (11358/11358) 100% |ooooo| Time: 00:07:28 Updating References codecollaborator: (16617/16617) 100% |ooooo| Time: 00:03:21 Updating References codecomplexity: (5593/5593) 100% |ooooo| Time: 00:01:07 Updating References codecoverage: (7175/7175) 100% |ooooo| Time: 00:01:27 Updating References findbug: (8566/8566) 100% |ooooo| Time: 00:01:44 Updating References nightlybuild: (1574/1574) 100% |ooooo| Time: 00:00:00 Updating References pmd: (8566/8566) 100% |ooooo| Time: 00:01:44 Updating References projects: (3/3) 100% |ooooo| Time: 00:00:00 Updating References regression: (98/98) 100% |ooooo| Time: 00:00:02 Updating References unittest: (8105/8105) 100% |ooooo| Time: 00:01:36 Updating References user_details: (5/5) 100% |ooooo| Time: 00:00:00 Removing pre_mongified_id appliance: (1/1) 100% |ooooo| Time: 00:00:00 Removing pre_mongified_id bat: (1/1) 100% |ooooo| Time: 00:00:00 Removing pre_mongified_id buildinfo: (1/1) 100% |ooooo| Time: 00:00:00 Removing pre_mongified_id codecollab: (1/1) 100% |ooooo| Time: 00:00:00 Removing pre_mongified_id codecomple: (1/1) 100% |ooooo| Time: 00:00:00 Removing pre_mongified_id codecovera: (1/1) 100% |ooooo| Time: 00:00:00 Removing pre_mongified_id findbug: (1/1) 100% |ooooo| Time: 00:00:00 Removing pre_mongified_id nightlybui: (1/1) 100% |ooooo| Time: 00:00:00 Removing pre_mongified_id pmd: (1/1) 100% |ooooo| Time: 00:00:00 Removing pre_mongified_id projects: (1/1) 100% |ooooo| Time: 00:00:00 Removing pre_mongified_id regression: (1/1) 100% |ooooo| Time: 00:00:00 Removing pre_mongified_id unittest: (1/1) 100% |ooooo| Time: 00:00:00 Removing pre_mongified_id user_detai: (1/1) 100% |ooooo| Time: 00:00:00

does it mean all the data transferred to mongodb ? Regards,

irfanjs commented 6 years ago

any update please ?

anlek commented 6 years ago

@irfanjs It's hard to say if "all data" has been moved. However, there wasn't any issues with the translation and therefore the data you've outlined in your translation.rb file has been moved. You'd have to review your data yourself to be 100% sure.

irfanjs commented 6 years ago

ok. thanks. we can close the issue.