Code Monkey home page Code Monkey logo

mongify's Introduction

Mongify

<img src=“https://badges.gitter.im/Join%20Chat.svg” alt=“Join the chat at https://gitter.im/anlek/mongify”> <img src=“https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg” alt=“Reviewed by Hound”>

mongify.com

A data translator from sql database to mongoDB.

Supports MySQL, PostgreSQL, SQLite, Oracle, SQLServer, and DB2 (Basically anything ActiveRecord has built-in). However, I’ve only tested it with MySql and SQLite

Supports any version of MongoDB

Learn more about MongoDB at: www.mongodb.org

Install

gem install mongify

NOTICE

You might have to install active record database gems (you'll know if you get an error message while running mongify command)

Usage

Creating a configuration file

In order for Mongify to do its job, it needs to know where your databases are located.

Building a config file is as simple as this:

sql_connection do
  adapter     "mysql"
  host        "localhost"
  username    "root"
  password    "passw0rd"
  database    "my_database"
  batch_size  10000           # This is defaulted to 10000 but in case you want to make that smaller (on lower RAM machines)
  # Uncomment the following line if you get a "String not valid UTF-8" error.
  # encoding "utf8"
end

mongodb_connection do
  host        "localhost"
  database    "my_database"
  # Uncomment the following line if you get a "String not valid UTF-8" error.
  # encoding "utf8"
end

You can check your configuration by running

mongify check database.config

Options

Currently the only supported option is for the mongodb_connection.

mongodb_connection :force => true do                # Forcing a mongodb_connection will drop the database before processing
  # ...
end

You can omit the mongodb connection until you’re ready to process your translation

Generating or creating a translation

Generating a translation

If your database is large and complex, it might be a bit too much work to write the translation file by hand. Mongify’s translate command can help with this:

mongify translation database.config

Or pipe it right into a file by running

mongify translation database.config > translation_file.rb

Creating a translation

Creating a translation is pretty straightforward. It looks something like this:

table "users" do
  column "id", :key
  column "first_name", :string
  column "last_name", :string
  column "created_at", :datetime
  column "updated_at", :datetime
end

table "posts" do
  column "id", :key
  column "title", :string
  column "owner_id", :integer, :references => :users
  column "body", :text
  column "published_at", :datetime
  column "created_at", :datetime
  column "updated_at", :datetime
end

table "comments", :embed_in => :posts, :on => :post_id do
  column "id", :key
  column "body", :text
  column "post_id", :integer, :references => :posts
  column "user_id", :integer, :references => :users
  column "created_at", :datetime
  column "updated_at", :datetime
end

table "preferences", :embed_in => :users, :as => :object do
  column "id", :key, :as => :string
  column "user_id", :integer, :references => "users"
  column "notify_by_email", :boolean
end

table "notes", :embed_in => true, :polymorphic => 'notable' do
  column "id", :key
  column "user_id", :integer, :references => "users"
  column "notable_id", :integer
  column "notable_type", :string
  column "body", :text
  column "created_at", :datetime
  column "updated_at", :datetime
end

Save the file as "translation_file.rb" and run the command:

mongify process database.config translation_file.rb

Commands

Usage: mongify command database_config [database_translation.rb]

Commands:
  "check" or "ck"           >> Checks connection for sql and no_sql databases [configuration_file]
  "process" or "pr"         >> Takes a translation and process it to mongodb [configuration_file, translation_file]
  "sync" or "sy"            >> Takes a translation and process it to mongodb, only syncs (insert/update) new or updated records based on the updated_at column [configuration_file, translation_file]
  "translation" or "tr"     >> Outputs a translation file from a sql connection [configuration_file]

Examples:

  mongify translation datbase.config
  mongify tr database.config
  mongify check database.config
  mongify process database.config database_translation.rb
  mongify sync database.config database_translation.rb

Common options:
    -h, --help                       Show this message
    -v, --version                    Show version

Translation Layout and Options

When dealing with a translation, there are a few options you can set

Table

Structure

Structure for defining a table is as follows:

table "table_name", {options} do
  # columns go here...
end

Options

Table Options are as follow:

table "table_name"                                        # Does a straight copy of the table
table "table_name", :embed_in => 'users'                  # Embeds table_name into users, assuming a user_id is present in table_name.
                                                          # This will also assume you want the table embedded as an array.

table "table_name",                                       # Embeds table_name into users, linking it via a owner_id
      :embed_in => 'users',                               # This will also assume you want the table embedded as an array.
      :on => 'owner_id'

table "table_name",                                       # Embeds table_name into users as a one to one relationship
      :embed_in => 'users',                               # This also assumes you have a user_id present in table_name
      :on => 'owner_id',                                  # You can also specify both :on and :as options when embedding
      :as => 'object'                                     # NOTE: If you rename the owner_id column, make sure you
                                                          # update the :on to the new column name

table "table_name", :rename_to => 'my_table'              # This will allow you to rename the table as it's getting process
                                                          # Just remember that columns that use :reference need to
                                                          # reference the new name.

table "table_name", :ignore => true                       # This will ignore the whole table (like it doesn't exist)
                                                          # This option is good for tables like: schema_migrations

table "table_name",                                       # This allows you to specify the table as being polymorphic
      :polymorphic => 'notable',                          # and provide the name of the polymorphic relationship.
      :embed_in => true                                   # Setting embed_in => true allows the relationship to be
                                                          # embedded directly into the parent class.
                                                          # If you do not embed it, the polymorphic table will be copied in to
                                                          # MongoDB and the notable_id will be updated to the new BSON::ObjectID

table "table_name" do                                     # A table can take a before_save block that will be called just
  before_save do |row|                                    # before the row is saved to the no sql database.
    row.admin = row.delete('permission').to_i > 50        # This gives you the ability to do very powerful things like:
  end                                                     # Moving records around, renaming records, changing values in row based on
end                                                       # some values! Checkout Mongify::Database::DataRow to learn more

table "users" do                                          # Here is how to set new ID using the old id
  before_save do |row|
    row._id = row.delete('pre_mongified_id')
  end
end

table "preferences", :embed_in => "users" do              # As of version 0.2, embedded tables with a before_save will take an
  before_save do |pref_row, user_row, unset_user_row|                     # extra argument which is the parent row of the embedded table.
    user_row.email_me = pref_row.delete('email_me')       # This gives you the ability to move things from an embedded table row
                                                          # to the parent row.
    if pref_row['one_name']
      unset_user_row['last_name'] = true                  # This will delete/unset the last name for the parent row
    end
  end
end

More documentation can be found at {Mongify::Database::Table}

Columns

Structure

Structure for defining a column is as follows:

column "name", :type, {options}

Columns with no type given will be set to :string

Notes

as of version 0.2: Leaving a column out when defining a table will result in the column being ignored

Types

Before we cover the options, you need to know what types of columns are supported:

:key                  # Columns that are primary keys need to be marked as :key type. You can provide an :as if your :key is not an integer column
:integer              # Will be converted to a integer
:float                # Will be converted to a float
:decimal              # Will be converted to a string (due to MongoDB Ruby Drivers not supporting BigDecimal, read details in Mongify::Database::Column under Decimal Storage)
:string               # Will be converted to a string
:text                 # Will be converted to a string
:datetime             # Will be converted to a Time format (DateTime is not currently supported in the Mongo ruby driver)
:date                 # Will be converted to a Time format (Date is not currently supported in the Mongo ruby driver)
:timestamps           # Will be converted to a Time format
:time                 # Will be converted to a Time format (the date portion of the Time object will be 2000-01-01)
:binary               # Will be converted to a string
:boolean              # Will be converted to a true or false values

Options

column "post_id", :integer, :references => :posts   # Referenced columns need to be marked as such, this will mean that they will be updated
                                                    # with the new BSON::ObjectID.
                                                    # NOTE: if you rename the table 'posts', you should set the :references to the new name

column "name", :string, :ignore => true             # Ignoring a column will make the column NOT copy over to the new database

column "surname",
       :string,
       :rename_to => 'last_name'                    # Rename_to allows you to rename the column

<em>For decimal columns you can specify a few options:</em>
column "total",                                     # This is a default conversion setting.
       :decimal,
       :as => 'string'

column "total",                                     # You can specify to convert your decimal to integer
        :decimal,                                   # specifying scale will define how many decimal places to keep
        :as => 'integer',                           # Example: :scale => 2 will convert 123.4567 to 12346 before saving
        :scale => 2

More documentation can be found at {Mongify::Database::Column}

Notes

Mongify has been tested on Ruby 1.8.7-p330, 1.9.2-p136, 1.9.3-p327, 2.0.0-p353, 2.1.1

If you have any issues, please feel free to report them here: issue tracker

Sync Note

If you want to continually sync your sql database with MongoDB using Mongify, you MUST run the sync feature from the start. Using the process command will not permit future syncing. The sync feature leaves the ‘pre_mongify_id` in your documents as well as it creates it’s own collection called ‘mongify_sync_helper` to keep dates and times of your last sync.

Additional Tools

As of May 2013, we’ve released an add-on tool to Mongify called Mongify-Mongoid which lets you use the translation.rb file to generate Mongoid models. It generates the model fields, relations (most of the way) and timestamps. This should save you some time from having to re-type all the models by hand. Check out the gem at: rubygems.org/gems/mongify-mongoid

TODO

  • Allow deeper embedding

  • Test in different databases

  • Give an ability to mark source DB rows as imported (allowing Mongify to run as a on going converter)

Known Issues

  • Can’t do anything to an embedded table

Development

Requirements

You just need bundler >= 1.0.8

gem install bundler
bundle install
copy over spec/support/database.example to spec/support/database.yml and fill in required info
rake test:setup:mysql
rake test:setup:postgresql
rake test

Special Thanks

Just want to thank my wife (Alessia) who not only puts up with me working on my free time but sometimes helps out listening to my craziness or helping me name classes or functions.

I would also like to thank Mon_Ouie on the Ruby IRC channel for helping me figure out how to setup the internal configuration file reading.

Another thanks goes out to eimermusic for his feedback on the gem, and a few bugs that he helps flush out. And to Pranas Kiziela who committed some bug and typo fixes that make Mongify even better!

About

This gem was made by Andrew Kalek from Anlek Consulting

Reach me at:

The sync functionality was made by Hossam Hammady from Qatar Computing Research Institute

Reach me at:

License

Copyright © 2011 - 2013 Andrew Kalek, Anlek Consulting

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

mongify's People

Contributors

altieres avatar anlek avatar asiansteev avatar gitter-badger avatar hammady avatar jvilaplana avatar nessche avatar pascalj avatar pranas avatar salbertson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mongify's Issues

I18 Enforce available locals error

When I run mongify I get this warning:

[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.

Mongify Killed after importing a large table

We run an import of a set of tables,
After running several tables, the mongify stops with a "Killed" message after importing a large table. I repeated the process several times with the same result:

mongify process database.config translation.rb
Copying table1: (2/2) 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:00
Copying table2: (22/22) 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:00
Copying table3: (11/11) 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:00
Copying table4: (5/5) 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:00
Copying table5: (120/120) 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:01
Copying table6: (6144/6144) 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:09
Copying table7: (2/2) 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:00
Copying table8: (9/9) 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:00
Copying table9: (191/191) 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:02
Copying table10: (165923/165923) 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:09:45
Killed

UTF8 Problem with Postgresql

Hi,
I have the same issue but in my case i'm using Postgresql it shows me this :

/Library/Ruby/Gems/2.0.0/gems/bson-1.10.2/lib/bson/bson_c.rb:20:in `serialize': String not valid UTF-8
(BSON::InvalidStringEncoding)

I added the "encoding "utf8" in the database.config" but it doesn't work.

Thanks for the attention

Table/Collection Doesn't Get Embedded or Imported

Hi Anlek, I'm having a problem similar to #44. I thought the different syntax options might have something to do with it, but I've mixed and matched, and it doesn't look like it's related.

I've been using Mongify to work with some data that was originally formatted as standard SQL tables. I think it's much better suited for a NoSQL arrangement and thankfully I stumbled onto Mongify. Everything was working great: the databases were hooked up, translation files were being generated, and 'process' was sending the stream into Mongo. But as I was tweaking things, Mongify just stopped embedding the documents.

All the data gets sent into Mongo except the table/collection that was to be embedded. It's not embedded in the intended parent collection and it doesn't come in on its own, either. All of a sudden, it worked for a single run again, but it went right back to not embedding. I've tried to tweak everything I can think of, but I just can't find the issue. What additional info can I pass on?

Crash when specifying a custom port in database config

Unfortunatly, I haven't got mongify to work with a custom port for a MySQL connection. I specified it like this:

sql_connection do
  adapter   "mysql"
  host      "host"
  username  "user"
  password  "password"
  port       3308
  database  "database"
end

On running mongify check I got this error somwhere deep down in Active Record:

/home/marr/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/mysql_adapter.rb:411:in `real_connect': can't convert String into Integer (TypeError)
from /home/marr/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/mysql_adapter.rb:411:in `connect'
from /home/marr/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/mysql_adapter.rb:131:in `initialize'
from /home/marr/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/mysql_adapter.rb:38:in `new'
from /home/marr/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/mysql_adapter.rb:38:in `mysql_connection'
from /home/marr/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
from /home/marr/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
from /home/marr/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
from /home/marr/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
from /home/marr/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
from /home/marr/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
from /home/marr/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
from /home/marr/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
from /home/marr/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
from /home/marr/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
from /home/marr/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
from /home/marr/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
from /home/marr/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
from /home/marr/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/mongify-0.9/lib/mongify/database/sql_connection.rb:55:in `has_connection?'
from /home/marr/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/mongify-0.9/lib/mongify/cli/command/worker.rb:91:in `check_sql_connection'
from /home/marr/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/mongify-0.9/lib/mongify/cli/command/worker.rb:63:in `execute'
from /home/marr/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/mongify-0.9/lib/mongify/cli/application.rb:28:in `execute!'
from /home/marr/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/mongify-0.9/bin/mongify:15:in `<top (required)>'
from /home/marr/.rbenv/versions/1.9.3-p392/bin/mongify:23:in `load'
from /home/marr/.rbenv/versions/1.9.3-p392/bin/mongify:23:in `<main>'

To me it seems like the port option gets converted to a String somewhere, which the MySQL gem can't deal with.

Adding date parts fields

Since MongoDB does not perform well with filtering according to YEAR(), MONTH(), DAY() and HOUR(), we need to create for each date field in the database new fields [original]_[year|month|day|hour] to enable fast query

Please find below the code changes:

table.rb
def translate(row, parent=nil)
new_row = {}
row.each do |key, value|
c = find_column(key)
new_row.merge!(c.translate(value)) #if c.present?
if c.is_date?
value = ActiveRecord::ConnectionAdapters::Column.string_to_time(value)
new_row.merge!(c.translate_year(value)).merge!(c.translate_month(value)).merge!(c.translate_day(value)).merge!(c.translate_hour(value))
end
run_before_save(new_row, parent)
return new_row;
end
end

column.rb
def is_date?
return (type == :datetime or type == :timestamp or type == :date)
end
def translate_year(value)
return {} if ignored?
{"#{self.name + '_year'}" => value.year}
end
def translate_month(value)
return {} if ignored?
{"#{self.name + '_month'}" => value.month}
end
def translate_day(value)
return {} if ignored?
{"#{self.name + '_day'}" => value.day}
end
def translate_hour(value)
return {} if ignored?
{"#{self.name + '_hour'}" => value.hour}
end

Can mongify do `has and belongs to many`?

I'm trying to migrate a database that among other things has a has and belongs to many relationship.

Basically, I have a users table, a roles table, and a roles_users table that has user_id and role_id.

Can I easily embed role into user?

Problems with Special Characters

Hi,

I have a UTF8 Database in MySQL.
It contains many entries with special characters ("maçã","evolução",etc).
When mongify processes it it stumble on the following error from BSON:

/usr/lib/ruby/gems/1.8/gems/bson-1.4.0/lib/../lib/bson/bson_c.rb:24:in `serialize': String not valid UTF-8 (BSON::InvalidStringEncoding)

Specs don't pass under REE ruby

Failures:

  1) Mongify::Database::Table before_save should work
     Failure/Error: row.admin = row.delete('permission').to_i > 50
     NoMethodError:
       undefined method `admin=' for [{"permission"=>"51"}, nil]:Array
     # ./spec/mongify/database/table_spec.rb:195
     # ./spec/../lib/mongify/database/table.rb:182:in `call'
     # ./spec/../lib/mongify/database/table.rb:182:in `run_before_save'
     # ./spec/../lib/mongify/database/table.rb:131:in `translate'
     # ./spec/mongify/database/table_spec.rb:215

  2) Mongify::Database::Table before_save run_before_save should create a new DataRow
     Failure/Error: row.admin = row.delete('permission').to_i > 50
     NoMethodError:
       undefined method `admin=' for [{"first_name"=>"Bob"}, nil]:Array
     # ./spec/mongify/database/table_spec.rb:195
     # ./spec/../lib/mongify/database/table.rb:182:in `call'
     # ./spec/../lib/mongify/database/table.rb:182:in `run_before_save'
     # ./spec/mongify/database/table_spec.rb:211:in `send'
     # ./spec/mongify/database/table_spec.rb:211

Any ways how we can merge two tables

I am looking for a way how to merge two tables (join)

TableA:
id: 1, name_a: 'A row1',
id: 2, name_a: 'A row2'
id: 3, name_a: 'A row3'

TableB:
ref_id_a: 1, name_b: 'B row1',
ref_id_a: 2, name_b: 'B row2'
ref_id_a: 3, name_b: 'B row3'

I tried:
table "TableB", :embed_in => "TableA", :on => "ref_id_a"

I am expecting result as:
_id:123456789098765432100001, id: 1, name_a: 'A row1', name_b: 'B row1',
_id:123456789098765432100002, id: 2, name_a: 'A row2', name_b: 'B row2',
_id:123456789098765432100003, id: 3, name_a: 'A row3', name_b: 'B row3',

Test Mode or Limit on Number of Records?

Hi, we have a fairly large database to convert from MySQL to MongoDB. This looks like the best tool I've come across so far for performing the conversion process.

Is there a way to limit the number of records to convert, so that we can test the conversion results before running all our 3+ million records?

Thanks!

Noob Question (How to create database.config and where to save it)

Hi I am new here, already created database.config C:\Ruby22-x64\lib\ruby\gems\2.2.0\gems\activesupport-3.2.21\lib\active_support\values. Even changed the filename to database.config.rb but when I run mongify check database.config it says Database configuration file is miss or cannot be found.

Thank you in advance guys.

Process hangs when using sqlserver

When using the sql adapter the process hangs and I get the following error stack

    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mongify-1.0.1/lib/mongify/database/sql_connection.rb:55:in `has_connection?'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mongify-1.0.1/lib/mongify/cli/command/worker.rb:91:in `check_sql_connection'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mongify-1.0.1/lib/mongify/cli/command/worker.rb:63:in `execute'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mongify-1.0.1/lib/mongify/cli/application.rb:28:in `execute!'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mongify-1.0.1/bin/mongify:15:in

    `<top (required)>'
    from C:/Ruby193/bin/mongify:23:in `load'
    from C:/Ruby193/bin/mongify:23:in `<main>'

or if I dont kill:

C:/Ruby193/lib/ruby/gems/1.9.1/gems/mongify-1.0.1/lib/mongify/cli/application.rb:34: stack level too deep (SystemStackError)

Any idea?

[FATAL] failed to allocate memory

[FATAL] failed to allocate memory occurs while "mongify process".
mongify crashed at converting a table that contains 3,000,934 records;
another table which has 600,089 records converted successfully.

mongify runs on centos 5, 16GB MEM, 4vCPU.

Mongify used approx. 4.3GB memory at maximum just before the crash.

mongify 0.3
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-linux]
gem 1.3.6

[root@mm6dev mm6]# gem list
*** LOCAL GEMS ***
activemodel (3.2.9)
activerecord (3.2.9)
activerecord-postgresql-adapter (0.0.1)
activesupport (3.2.9)
arel (3.0.2)
bson (1.8.0)
bson_ext (1.8.0)
builder (3.0.4)
highline (1.6.15)
i18n (0.6.1)
mongify (0.3)
mongo (1.8.0)
multi_json (1.5.0)
mysql2 (0.3.11)
pg (0.11.0, 0.10.0, 0.9.0)
tzinfo (0.3.35)

database.config:
sql_connection do
adapter "postgresql"
host "localhost"
username "foo"
password "bar"
database "test"
end

mongodb_connection do
host "localhost"
database "test"
end

Migration too slow

Is it normal for the migration to take 5-6 hrs to migrate 315MB of data? I feel like I am doing things wrong. Would appreciate any suggestions.

Thanks a lot!

translate string to array

in the mysql db I have an array stored as a string example "[3.3,3.2,3,2.8]"
i would like to translate that so its stored just as an array {myArray: [3.3,3.2,3,2.8] }

is this possible ?

Mysql to MongoDB records to be populated based on the condition

Hi,

I want populate the data from mysql to mongodb based on the where condition using MONGIFY, can you please help me to do this?

Sample mysql query : select * from bmtest where Status=1 and Validated>=1;

Mysql Data:

select * from bmtest;
+---------+--------------+--------+-----------+--------+
| MatriId | Name | Gender | Validated | Status |
+---------+--------------+--------+-----------+--------+
| 11 | Senthilkumar | M | 0 | 1 |
| 11 | Mukunthan | M | 1 | 0 |
| 33 | Thirisha | F | 1 | 1 |
| 111116 | Prithi | F | 1 | 0 |
| 123456 | Sathish | M | 1 | 1 |
| 123457 | Ram | M | 1 | 1 |
| 123458 | Rani | F | 2 | 1 |
| 123459 | Vijaya | F | 1 | 0 |
+---------+--------------+--------+-----------+--------+

translation.rb

table "bmtest", :rename_to => 'my_table' do
column "MatriId", :string
column "Name", :string
column "Gender", :string
column "Validated", :integer
column "Status", :integer
end

Thanks,
Sathish prabu

_id field as a string

Some platform, something like Meteor.js, is using _id field as a string for some reason,
so is there any way not to set _id field as a ObjectId but String?

Thanks.

Cancel insert from before_save

It would be nice to be able to cancel insertion of the current record from within a before_save block. I've got an embedded table and I want to cancel the insert if the record is a dup.

cant install mongify

Im on mountain lion cannot get mongify to install

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql2-0.3.11 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/ext/mysql2/gem_make.out

Syntax

I am not able to take to 2 tables in mysql that do not have any relationship and embed both into one document with arrays, using a common field say 'user_login_id'. Also, the syntax varies from 'table "comments", :embed_in => :posts, :on => :post_id do' to in GitHUB and 'table "table_name", :embed_in => 'users' ' in Rubydoc.

Mongifying gets gradually slower until dies

Because of the huge offsets, I couldn't mongify my table and it got gradually slower. Is it possible to change the query from
SELECT * FROM foobar LIMIT 10000 OFFSET 1000000;
to
SELECT * FROM foobar WHERE id > 1000000 ORDER BY id ASC LIMIT 10000;
where the id would be the latest imported id?

Performance issues w/ Mongify

When we run Mongify (from MySQL to MongoDB)
It seems that the Mongify is non efficients, as the process takes about 92% of a single core CPU, while the MongoDB and MySQL CPU is neglectable (2-5% each)
Moreover, there are no IO issues that you will expect from such kind of process.

Can't install Mongify 0.1.5 on Ruby 1.9

When running

gem install mongify

This is the result:

Fetching: SystemTimer-1.2.3.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing mongify:
    ERROR: Failed to build gem native extension.

        /Users/andrew/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
creating Makefile

make
gcc -I. -I/Users/andrew/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/x86_64-darwin10.7.0 -I/Users/andrew/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/backward -I/Users/andrew/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long  -fno-common -pipe  -o system_timer_native.o -c system_timer_native.c
In file included from system_timer_native.c:8:
/Users/andrew/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/backward/rubysig.h:14:2: warning: #warning rubysig.h is obsolete
system_timer_native.c: In function ‘install_first_timer_and_save_original_configuration’:
system_timer_native.c:46: warning: passing argument 1 of ‘log_debug’ discards qualifiers from pointer target type
system_timer_native.c:53: warning: passing argument 1 of ‘log_error’ discards qualifiers from pointer target type
system_timer_native.c:57: warning: passing argument 1 of ‘log_debug’ discards qualifiers from pointer target type
system_timer_native.c:62: warning: passing argument 1 of ‘log_debug’ discards qualifiers from pointer target type
system_timer_native.c:65: warning: passing argument 1 of ‘log_error’ discards qualifiers from pointer target type
system_timer_native.c:69: warning: passing argument 1 of ‘log_debug’ discards qualifiers from pointer target type
system_timer_native.c:82: warning: passing argument 1 of ‘log_error’ discards qualifiers from pointer target type
system_timer_native.c:89: warning: passing argument 1 of ‘log_debug’ discards qualifiers from pointer target type
system_timer_native.c:96: warning: passing argument 1 of ‘log_error’ discards qualifiers from pointer target type
system_timer_native.c:101: warning: passing argument 1 of ‘log_debug’ discards qualifiers from pointer target type
system_timer_native.c: In function ‘install_next_timer’:
system_timer_native.c:112: warning: passing argument 1 of ‘log_debug’ discards qualifiers from pointer target type
system_timer_native.c:119: warning: passing argument 1 of ‘log_error’ discards qualifiers from pointer target type
system_timer_native.c:123: warning: passing argument 1 of ‘log_debug’ discards qualifiers from pointer target type
system_timer_native.c:130: warning: passing argument 1 of ‘log_error’ discards qualifiers from pointer target type
system_timer_native.c:136: warning: passing argument 1 of ‘log_debug’ discards qualifiers from pointer target type
system_timer_native.c:143: warning: passing argument 1 of ‘log_error’ discards qualifiers from pointer target type
system_timer_native.c:146: warning: passing argument 1 of ‘log_debug’ discards qualifiers from pointer target type
system_timer_native.c: In function ‘restore_original_configuration’:
system_timer_native.c:157: warning: passing argument 1 of ‘log_error’ discards qualifiers from pointer target type
system_timer_native.c:160: warning: passing argument 1 of ‘log_debug’ discards qualifiers from pointer target type
system_timer_native.c:168: warning: passing argument 1 of ‘log_error’ discards qualifiers from pointer target type
system_timer_native.c:170: warning: passing argument 1 of ‘log_debug’ discards qualifiers from pointer target type
system_timer_native.c:172: warning: passing argument 1 of ‘log_error’ discards qualifiers from pointer target type
system_timer_native.c: In function ‘restore_original_timer_interval’:
system_timer_native.c:190: warning: passing argument 1 of ‘log_error’ discards qualifiers from pointer target type
system_timer_native.c:192: warning: passing argument 1 of ‘log_debug’ discards qualifiers from pointer target type
system_timer_native.c: In function ‘restore_sigalrm_mask’:
system_timer_native.c:199: warning: passing argument 1 of ‘log_debug’ discards qualifiers from pointer target type
system_timer_native.c:201: warning: passing argument 1 of ‘log_debug’ discards qualifiers from pointer target type
system_timer_native.c: In function ‘install_ruby_sigalrm_handler’:
system_timer_native.c:211: error: ‘rb_thread_critical’ undeclared (first use in this function)
system_timer_native.c:211: error: (Each undeclared identifier is reported only once
system_timer_native.c:211: error: for each function it appears in.)
system_timer_native.c: In function ‘restore_original_ruby_sigalrm_handler’:
system_timer_native.c:217: error: ‘rb_thread_critical’ undeclared (first use in this function)
system_timer_native.c: In function ‘clear_pending_sigalrm_for_ruby_threads’:
system_timer_native.c:266: warning: passing argument 1 of ‘log_debug’ discards qualifiers from pointer target type
system_timer_native.c: In function ‘set_itimerval’:
system_timer_native.c:290: warning: passing argument 1 of ‘log_debug’ discards qualifiers from pointer target type
system_timer_native.c:295: warning: implicit conversion shortens 64-bit value into a 32-bit value
system_timer_native.c:299: warning: passing argument 1 of ‘log_debug’ discards qualifiers from pointer target type
make: *** [system_timer_native.o] Error 1


Gem files will remain installed in /Users/andrew/.rvm/gems/ruby-1.9.2-p180/gems/SystemTimer-1.2.3 for inspection.
Results logged to /Users/andrew/.rvm/gems/ruby-1.9.2-p180/gems/SystemTimer-1.2.3/ext/system_timer/gem_make.out

Mongify check database.config error message

"> mongify check database.config"


[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
/Library/Ruby/Site/2.0.0/rubygems/dependency.rb:298:in `to_specs': Please install the mysql adapter: `gem install activerecord-mysql-adapter` (Could not find 'mysql' (~> 2.8) among 59 total gem(s)) (LoadError)
    from /Library/Ruby/Site/2.0.0/rubygems/dependency.rb:309:in `to_spec'
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:53:in `gem'
    from /Library/Ruby/Gems/2.0.0/gems/activerecord-3.2.16/lib/active_record/connection_adapters/mysql_adapter.rb:5:in `<top (required)>'
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `require'
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require'
    from /Library/Ruby/Gems/2.0.0/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251:in `block in require'
    from /Library/Ruby/Gems/2.0.0/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Library/Ruby/Gems/2.0.0/gems/activesupport-3.2.16/lib/active_support/dependencies.rb:251:in `require'
    from /Library/Ruby/Gems/2.0.0/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_specification.rb:50:in `resolve_hash_connection'
    from /Library/Ruby/Gems/2.0.0/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_specification.rb:29:in `spec'
    from /Library/Ruby/Gems/2.0.0/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_specification.rb:130:in `establish_connection'
    from /Library/Ruby/Gems/2.0.0/gems/mongify-1.2.4/lib/mongify/database/sql_connection.rb:40:in `setup_connection_adapter'
    from /Library/Ruby/Gems/2.0.0/gems/mongify-1.2.4/lib/mongify/database/sql_connection.rb:56:in `has_connection?'
    from /Library/Ruby/Gems/2.0.0/gems/mongify-1.2.4/lib/mongify/cli/command/worker.rb:95:in `check_sql_connection'
    from /Library/Ruby/Gems/2.0.0/gems/mongify-1.2.4/lib/mongify/cli/command/worker.rb:64:in `execute'
    from /Library/Ruby/Gems/2.0.0/gems/mongify-1.2.4/lib/mongify/cli/application.rb:28:in `execute!'
    from /Library/Ruby/Gems/2.0.0/gems/mongify-1.2.4/bin/mongify:15:in `<top (required)>'
    from /usr/bin/mongify:23:in `load'
    from /usr/bin/mongify:23:in `<main>'

What should i do?

Ability to handle multiple date formats

Need to be able to identify what date format the source data is in. Currently, mm/dd/yyyy is incorrectly translated to dd/mm/yyyy. i.e., 11/04/2011 becomes July 11, 2011.

no implicit conversion of Time into String (TypeError)

Mongify works in process mode (although seems to timeout somewhere for me on updating)
When i try with sync I get this error. The translation remains the same. Any ideas?

/home/cabox/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/time.rb:325:in _parse': no implicit conversion of Time into String (TypeError) | ETA: --:--:-- from /home/cabox/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/time.rb:325:inparse'
from /home/cabox/.rvm/gems/ruby-2.1.2/gems/mongify-1.2.4/lib/mongify/translation/sync.rb:66:in block (2 levels) in sync_data' from /home/cabox/.rvm/gems/ruby-2.1.2/gems/mongify-1.2.4/lib/mongify/translation/sync.rb:64:ineach'
from /home/cabox/.rvm/gems/ruby-2.1.2/gems/mongify-1.2.4/lib/mongify/translation/sync.rb:64:in block in sync_data' from /home/cabox/.rvm/gems/ruby-2.1.2/gems/mongify-1.2.4/lib/mongify/translation/sync.rb:58:ineach'
from /home/cabox/.rvm/gems/ruby-2.1.2/gems/mongify-1.2.4/lib/mongify/translation/sync.rb:58:in sync_data' from /home/cabox/.rvm/gems/ruby-2.1.2/gems/mongify-1.2.4/lib/mongify/translation/sync.rb:29:insync'
from /home/cabox/.rvm/gems/ruby-2.1.2/gems/mongify-1.2.4/lib/mongify/cli/command/worker.rb:71:in execute' from /home/cabox/.rvm/gems/ruby-2.1.2/gems/mongify-1.2.4/lib/mongify/cli/application.rb:28:inexecute!'
from /home/cabox/.rvm/gems/ruby-2.1.2/gems/mongify-1.2.4/bin/mongify:15:in <top (required)>' from /home/cabox/.rvm/gems/ruby-2.1.2/bin/mongify:23:inload'
from /home/cabox/.rvm/gems/ruby-2.1.2/bin/mongify:23:in <main>' from /home/cabox/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:ineval'
from /home/cabox/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `

'

undefined method `table'

When running mongify process translation.rb database.config I get this error:
/usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/mongify-1.0.1/lib/mongify/configuration.rb:14:in instance_eval': undefined method table' for #<Mongify::Configuration:0x007fe964327918> (NoMethodError)

The file made by translation hasn't been changed

[1.2.4] embed_in not working with latest version?

Dear maintainers,

I have problems embedding some tables, I have tried all kinds of things but cannot get embedding to work.

My code looks as follows:

table "tmpPhenotypeExperiment", :rename_to => 'phenotypeExperiment' do
   column "id", :key
   column "blabla", :integer
   column "blubb", :string
end


table "tmpExperiment2",                                       
      :embed_in => 'phenotypeExperiment',                               
      :on => 'phenotypeExperiment_id',                                  
      :as => 'object'

when I run the mongify "process" task it creates the phenotypeExperiment correctly but is not embedding anything :(. It just creates the tmpPhenotypeExperiment table.

here is my mysql create table statements:

CREATE TABLE `tmpPhenotypeExperiment` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
  `blabla` bigint(20) DEFAULT NULL,
  `blubb` longtext COLLATE utf8_unicode_ci,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2528 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci |

and

CREATE TABLE `tmpExperiment2` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
...[some fields here]...
 `phenotypeExperiment_id` bigint(20) DEFAULT NULL)

On mysql I can do a join and get results:

select * from tmpExperiment2 A inner join tmpPhenotypeExperiment B on A.phenotypeExperiment_id = B.id;

is embedding broken in the latest version?

:rename_to on column is not always renaming

For some strange reason it seems rename_to isn't always kicking in. In this example, rename does NOT rename anything below postal_code:

  table "account" do
    column "id", :key
    column "name", :string, :rename_to => 'full_name'
    column "address_street", :string, :rename_to => 'street'
    column "address_city", :string, :rename_to => 'city'
    column "address_prov", :string, :rename_to => 'province'
    column "address_pcode", :string, :rename_to => 'postal_code'
    column "geoLatitude", :string, :rename_to => 'latitude'
    column "geoLongitude", :string, :rename_to => 'longitude'
    column "created_at", :datetime
    column "updated_at", :datetime
    column "url", :string, :rename_to => 'website'
  end

Mongify command not found

I have installed ruby using "brew install ruby", than installed mongify using "gem install mongify". However then I type "mongify" command it returns "fish: Unknown command 'mongify'" in iTerm, or "-bash: mongify: command not found" in Terminal. What am I doing wrong?

Mongify Embed document

I'm migrating DB from MySql to MongoDB and I want two table to embed. My translation file is as below. I want to embed block table in pages table. Here relationship is 1:n. The mongify process runs without issue but when I check the data the embed has not happened.

table "pages" do
column "id", :key, :as => :integer
column "appid", :integer
column "uri", :string
column "title", :string
column "page_data", :text
column "created", :datetime
column "modified", :datetime
column "deleted", :boolean

end

table "blocks", :embed_in => :pages, :on => :pageid do
column "id", :key, :as => :integer
column "pageid", :integer, :references => "pages"
column "sort", :integer
column "type", :string
column "block_data", :text
column "created", :datetime
column "modified", :datetime
column "deleted", :boolean
end

Thank You

database names cannot contain the character ' '

Getting an error during the final step. I'm dealing with a massive bunch of data. I've tried two mysql databases with the same error message each time. Any suggestion on how to isolate the offensive tables, or syntax?

mongify process database.config translation_olpxadmin.rb
/home/jesse/.rvm/gems/ruby-2.0.0-p0/gems/mongo-1.8.5/lib/mongo/util/support.rb:54:in `block in validate_db_name': database names cannot contain the character ' ' (Mongo::InvalidNSName)

Mongify check : uninitialized constant BSON::ByteBuffer

Hi,

When I run : mongify ck -c database.config

I get this error :

.rvm/gems/ruby-1.9.3-p286/gems/mongo-1.3.1/lib/mongo/cursor.rb:419:in `construct_query_message': uninitialized constant BSON::ByteBuffer (NameError)

Database.config :

sql_connection do
adapter "mysql2"
host "localhost"
socket "/Applications/MAMP/tmp/mysql/mysql.sock"
username "root"
password "*************"
database "BD_JDR_ROR"
end

mongodb_connection do
host "localhost"
database "nedubad_test"
end

What i'm doing wrong ?

Get gem conflict when install

evgeniy@evgeniy-Inspiron-5720:$ rvm gemset create mongify
gemset created mongify => /home/evgeniy/.rvm/gems/ruby-1.9.3-p448@mongify
evgeniy@evgeniy-Inspiron-5720:
$ rvm use 1.9.3@mongify
Using /home/evgeniy/.rvm/gems/ruby-1.9.3-p448 with gemset mongify
evgeniy@evgeniy-Inspiron-5720:$ gem install mongify
Fetching: activesupport-4.0.2.gem (100%)
Fetching: bson-1.8.6.gem (100%)
Fetching: mongo-1.8.6.gem (100%)
Fetching: bson_ext-1.8.6.gem (100%)
Building native extensions. This could take a while...
Fetching: mongify-1.0.0.gem (100%)
Fetching: activemodel-4.0.2.gem (100%)
Successfully installed activesupport-4.0.2
Successfully installed bson-1.8.6
Successfully installed mongo-1.8.6
Successfully installed bson_ext-1.8.6
Successfully installed mongify-1.0.0
Successfully installed activemodel-4.0.2
6 gems installed
Installing ri documentation for activesupport-4.0.2...
Installing ri documentation for bson-1.8.6...
Installing ri documentation for mongo-1.8.6...
Installing ri documentation for bson_ext-1.8.6...
Installing ri documentation for mongify-1.0.0...
Installing ri documentation for activemodel-4.0.2...
Installing RDoc documentation for activesupport-4.0.2...
Installing RDoc documentation for bson-1.8.6...
Installing RDoc documentation for mongo-1.8.6...
Installing RDoc documentation for bson_ext-1.8.6...
Installing RDoc documentation for mongify-1.0.0...
Installing RDoc documentation for activemodel-4.0.2...
evgeniy@evgeniy-Inspiron-5720:
$ mongify process database.config translation2.1.rb
/home/evgeniy/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1638:in raise_if_conflicts': Unable to activate activerecord-4.0.0, because activesupport-4.0.2 conflicts with activesupport (= 4.0.0) (Gem::LoadError) from /home/evgeniy/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:747:inactivate'
from /home/evgeniy/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:51:in block in require' from /home/evgeniy/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:50:ineach'
from /home/evgeniy/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:50:in require' from /home/evgeniy/.rvm/gems/ruby-1.9.3-p448@mongify/gems/mongify-1.0.0/lib/mongify.rb:5:in<top (required)>'
from /home/evgeniy/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in require' from /home/evgeniy/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:inrequire'
from /home/evgeniy/.rvm/gems/ruby-1.9.3-p448@mongify/gems/mongify-1.0.0/lib/mongify/cli.rb:1:in <top (required)>' from /home/evgeniy/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:inrequire'
from /home/evgeniy/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in require' from /home/evgeniy/.rvm/gems/ruby-1.9.3-p448@mongify/gems/mongify-1.0.0/bin/mongify:10:in<top (required)>'
from /home/evgeniy/.rvm/gems/ruby-1.9.3-p448@mongify/bin/mongify:19:in load' from /home/evgeniy/.rvm/gems/ruby-1.9.3-p448@mongify/bin/mongify:19:in

'
from /home/evgeniy/.rvm/gems/ruby-1.9.3-p448@mongify/bin/ruby_noexec_wrapper:14:in eval' from /home/evgeniy/.rvm/gems/ruby-1.9.3-p448@mongify/bin/ruby_noexec_wrapper:14:in'

[BUG] Segmentation fault

➜ ws git:(master) mongify -h
/Users/marshluca/.gem/ruby/1.8/gems/hpricot-0.8.4/lib/fast_xs.bundle: [BUG] Segmentation fault
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10.8.0], MBARI 0x6770, Ruby Enterprise Edition 2011.03

[1] 8415 abort mongify -h

mongify: command not found

Hello,
I installed mongify successfully but the mongify command gives the message "mongify: command not found"
Am I missing any other gems / libraries?

Thanks

Level 2 embedding workaround?

I see allow deeper embedding on the todo list. In the mean time, would you have a recommended work around for one additional level... embed into an embedded document?

Problem with undefined method sql_conection

I try to run the check database.config and I get the following errors.

[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
/var/lib/gems/1.9.1/gems/mongify-1.2.4/lib/mongify/configuration.rb:14:in instance_eval': undefined methodsql_conection' for #Mongify::Configuration:0x00000001dffda8 (NoMethodError)
from /var/lib/gems/1.9.1/gems/mongify-1.2.4/lib/mongify/configuration.rb:14:in instance_eval' from /var/lib/gems/1.9.1/gems/mongify-1.2.4/lib/mongify/configuration.rb:14:inparse'
from /var/lib/gems/1.9.1/gems/mongify-1.2.4/lib/mongify/cli/options.rb:78:in config_file' from /var/lib/gems/1.9.1/gems/mongify-1.2.4/lib/mongify/cli/options.rb:58:inparse'
from /var/lib/gems/1.9.1/gems/mongify-1.2.4/lib/mongify/cli/application.rb:27:in execute!' from /var/lib/gems/1.9.1/gems/mongify-1.2.4/bin/mongify:15:in<top (required)>'
from /usr/local/bin/mongify:23:in load' from /usr/local/bin/mongify:23:in

'

I have the install activerecord-mysql-adapter installed.

Are both notations accepted?

What is the difference between :references => :posts vs :references => "posts"?
And :embed_in => :posts vs :embed_in => "posts"?

Are the 2 notations equivalent?

String not valid UTF-8

    /Library/Ruby/Gems/2.0.0/gems/bson-1.8.6/lib/bson/bson_c.rb:6:in `serialize': String not valid UTF-8 (BSON::InvalidStringEncoding)
        from /Library/Ruby/Gems/2.0.0/gems/bson-1.8.6/lib/bson/bson_c.rb:6:in `serialize'
        from /Library/Ruby/Gems/2.0.0/gems/mongo-1.8.6/lib/mongo/collection.rb:1098:in `block in insert_documents'
        from /Library/Ruby/Gems/2.0.0/gems/mongo-1.8.6/lib/mongo/collection.rb:1097:in `each'
        from /Library/Ruby/Gems/2.0.0/gems/mongo-1.8.6/lib/mongo/collection.rb:1097:in `insert_documents'
        from /Library/Ruby/Gems/2.0.0/gems/mongo-1.8.6/lib/mongo/collection.rb:375:in `insert'
        from /Library/Ruby/Gems/2.0.0/gems/mongify-1.0.0/lib/mongify/database/no_sql_connection.rb:98:in `insert_into'
        from /Library/Ruby/Gems/2.0.0/gems/mongify-1.0.0/lib/mongify/translation/process.rb:47:in `block (2 levels) in copy_data'
        from /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.2/lib/active_record/result.rb:21:in `block in each'
        from /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.2/lib/active_record/result.rb:21:in `each'
        from /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.2/lib/active_record/result.rb:21:in `each'
        from /Library/Ruby/Gems/2.0.0/gems/mongify-1.0.0/lib/mongify/translation/process.rb:46:in `block in copy_data'
        from /Library/Ruby/Gems/2.0.0/gems/mongify-1.0.0/lib/mongify/translation/process.rb:43:in `each'
        from /Library/Ruby/Gems/2.0.0/gems/mongify-1.0.0/lib/mongify/translation/process.rb:43:in `copy_data'
        from /Library/Ruby/Gems/2.0.0/gems/mongify-1.0.0/lib/mongify/translation/process.rb:22:in `process'
        from /Library/Ruby/Gems/2.0.0/gems/mongify-1.0.0/lib/mongify/cli/command/worker.rb:67:in `execute'
        from /Library/Ruby/Gems/2.0.0/gems/mongify-1.0.0/lib/mongify/cli/application.rb:28:in `execute!'
        from /Library/Ruby/Gems/2.0.0/gems/mongify-1.0.0/bin/mongify:15:in `<top (required)>'
        from /usr/bin/mongify:23:in `load'
        from /usr/bin/mongify:23:in `<main>'

could not went into the database.config

hi everyone in mongify, whoever is viewing this, do help me.

i currently doing this project from SQL database to mongify which is what i doing now in this link. i have completed my "gem install mongify" but my next step going into database.config is fail.

ubuntu version: 14.04
and as for ruby version: i not sure how to check...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.