mongify icon indicating copy to clipboard operation
mongify copied to clipboard

Update failed error in - mongify process command

Open jyotman opened this issue 9 years ago • 8 comments

I'm getting an error using the mongify process command. All the data is copied to MongoDB from PostgreSQL but the respective foreign key ids are not updated.

This is the error I get -

Copying projects (1/1): (1387/1387) 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:00 Copying users (1/1): (1763/1763) 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:00 Updating References projects: (1387/1387) 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:03 Updating References users: (1763/1763) 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:02 /var/lib/gems/2.3.0/gems/mongo-1.12.5/lib/mongo/db.rb:610:in 'rescue in command': Database command 'update' failed: Unknown option to update command: multi (Mongo::OperationFailure) from /var/lib/gems/2.3.0/gems/mongo-1.12.5/lib/mongo/db.rb:606:in 'command' from /var/lib/gems/2.3.0/gems/mongo-1.12.5/lib/mongo/collection_writer.rb:314:in 'block in send_write_command' from /var/lib/gems/2.3.0/gems/mongo-1.12.5/lib/mongo/functional/logging.rb:55:in 'block in instrument' from /var/lib/gems/2.3.0/gems/mongo-1.12.5/lib/mongo/functional/logging.rb:20:in 'instrument' from /var/lib/gems/2.3.0/gems/mongo-1.12.5/lib/mongo/functional/logging.rb:54:in 'instrument' from /var/lib/gems/2.3.0/gems/mongo-1.12.5/lib/mongo/collection_writer.rb:313:in 'send_write_command' from /var/lib/gems/2.3.0/gems/mongo-1.12.5/lib/mongo/collection.rb:1104:in 'send_write' from /var/lib/gems/2.3.0/gems/mongo-1.12.5/lib/mongo/collection.rb:497:in 'update' from /var/lib/gems/2.3.0/gems/mongify-1.3.1/lib/mongify/database/no_sql_connection.rb:145:in 'remove_pre_mongified_ids' from /var/lib/gems/2.3.0/gems/mongify-1.3.1/lib/mongify/translation/processor_common.rb:116:in 'block in remove_pre_mongified_ids' from /var/lib/gems/2.3.0/gems/mongify-1.3.1/lib/mongify/translation/processor_common.rb:114:in 'each' from /var/lib/gems/2.3.0/gems/mongify-1.3.1/lib/mongify/translation/processor_common.rb:114:in 'remove_pre_mongified_ids' from /var/lib/gems/2.3.0/gems/mongify-1.3.1/lib/mongify/translation/process.rb:18:in 'process' from /var/lib/gems/2.3.0/gems/mongify-1.3.1/lib/mongify/cli/command/worker.rb:72:in 'execute' from /var/lib/gems/2.3.0/gems/mongify-1.3.1/lib/mongify/cli/application.rb:28:in 'execute!' from /var/lib/gems/2.3.0/gems/mongify-1.3.1/bin/mongify:15:in '<top (required)>' from /usr/local/bin/mongify:23:in 'load' from /usr/local/bin/mongify:23:in '<main>'

This is my translation file -

table "projects" do
	column "project_id", :integer, :references => "projects"
	column "projectname", :string
	column "description", :text
	column "link", :string
	column "created_on", :datetime
	column "updated_on", :datetime
	column "project_image_ratio", :float
	column "project_image_url", :string
	column "owner_id", :integer, :references => "users"
end

table "users" do
	column "user_id", :integer, :references => "users"
	column "username", :string
	column "email", :string
	column "location", :string
	column "about_me", :text
	column "created_on", :datetime
	column "updated_on", :datetime
	column "password_hash", :string
	column "user_image_ratio", :float
	column "user_image_url", :string
	column "phone_number", :string
	column "email_verified", :boolean
	column "registered", :boolean
	column "phone_number_verified", :boolean
	column "feedback_message", :string
	column "first_name", :string
	column "last_name", :string
	column "handle", :string
	column "city", :string
	column "country", :string
	column "extension", :string
	column "fcm_token", :string
	column "feedback", :string
	column "is_new_user", :string
	column "new_user_status", :string
	column "show_feedback_dialog", :string
	column "current_app_version", :integer
	column "last_notification_time", :string
end

This is the database.config file -

sql_connection do
  adapter     "postgresql"
  host        "localhost"
  username    "******"
  password    "******"
  database    "*******"
  batch_size  10000
end

mongodb_connection do
  host        "localhost"
  database    "**********"
end

jyotman avatar Dec 05 '16 08:12 jyotman

I got the same problem. I try to rollback Mongo database from version 3.4 to 3.2 and the error is gone.

ibotdotout avatar Dec 27 '16 08:12 ibotdotout

any fixes planned for this?

artjomg avatar Jan 30 '17 22:01 artjomg

Hey @artjomg, I'm unable to dedicate time to fix this at the moment, but will gladly review pull requests.

anlek avatar Feb 10 '17 12:02 anlek

Done ... downgrading to 3.2 works.. no more errors...evrything running smooth ..thnks

optimus93 avatar Feb 11 '17 06:02 optimus93

@anlek - hey brother... can we merge columns of two different tables in mongify ?

optimus93 avatar Feb 11 '17 07:02 optimus93

@optimus93 Yes, you can, by embedding one into the other, and using the before_save method and pushing the values to parent_row. Read the docs to learn more.

anlek avatar Feb 15 '17 08:02 anlek

Dear @anlek , Nowadays MongoDB lowest version is 4.4 (and it's not possible to use MongoDB version 3.2 anymore due to it's end of life being on 2018). Given that the problem mentioned in this issue came up again and once the downgrade is not a solution anymore. Is it possible to have another fix/workaround for that issue? Thanks in advance.

rodrigotrombeta avatar Sep 10 '21 12:09 rodrigotrombeta

Unfortunately, I don't have a solution at this time. If I had more time, I might be able to upgrade the dependencies. However, life is a bit busier these days then it used to be.

anlek avatar Sep 11 '21 20:09 anlek