Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixes mongodb migration
  • Loading branch information
moritzschepp committed Nov 19, 2017
1 parent d7ebdbe commit ff52d0a
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions db/migrate/20141101121336_remove_mongodb.rb
Expand Up @@ -2,20 +2,21 @@ class RemoveMongodb < ActiveRecord::Migration
def up
add_column :entities, :attachment, :text

# # config = Rails.configuration.database_configuration[Rails.env]["mongo"].reverse_merge(
# 'host' => '127.0.0.1',
# 'port' => 27017
# )
config = Rails.configuration.database_configuration[Rails.env]["mongo"].reverse_merge(
'host' => '127.0.0.1',
'port' => 27017
)

# command = [
# "mongoexport",
# "-h #{config['host']}:#{config['port']}",
# "--db #{config['database']}",
# "--jsonArray",
# "--collection attachments"
# ].join(' ')
command = [
"mongoexport",
"-h #{config['host']}:#{config['port']}",
"--db #{config['database']}",
"--jsonArray",
"--collection attachments"
].join(' ')

data = JSON.parse(File.read "./attachments.json")
data = JSON.parse(`#{command}`)
# data = JSON.parse(File.read "./attachments.json")

puts "Iterating mongodb documents"
counter = 0
Expand Down

0 comments on commit ff52d0a

Please sign in to comment.